If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Problem with HIbernate and DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-05-08, 09:26
kafftarbaz kafftarbaz is offline
Registered User
 
Join Date: Jan 2008
Posts: 4
Problem with HIbernate and DB2

Hello Folks,

I have a problem with HIbernate mapping and DB2. Maybe you can help me. Here ist the Exception:
org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of de.dcfs.quest.model.dataobjects.RVarRegions.actSta tus

The other files are attached to this Thread and If you need more details, please let me know.

Thanks in adavance!

Best Regards,
Kafftarbaz
Attached Files
File Type: zip _Hibernate-Problem.zip (4.9 KB, 52 views)
Reply With Quote
  #2 (permalink)  
Old 02-05-08, 17:28
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by kafftarbaz
/*
The next step throws this Exception!!!!!!!!
org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of de.dcfs.quest.model.dataobjects.RVarRegions.actSta tus
*/
result = session.createQuery(
"from RVarRegions where actStatus <> 1 ")
.list();
Try changing this to
Code:
result = session.createQuery(
"select * from RVarRegions where actStatus <> 1 ") .list()
just to see if that "solves" the problem (or at least shifts the error to some lines further down).
If so, you will probably have to replace the added "*" by something more specific...
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #3 (permalink)  
Old 02-05-08, 17:35
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by Peter.Vanroose
Code:
result = session.createQuery(
"select * from RVarRegions where actStatus <> 1 ") .list()
Actually, from the table definition, it seems like it should even be rather something like:
Code:
result = session.createQuery(
"select * from R_Var_Regions where act_Status <> 1 ") .list()
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #4 (permalink)  
Old 02-06-08, 05:59
kafftarbaz kafftarbaz is offline
Registered User
 
Join Date: Jan 2008
Posts: 4
Hello Folks,

thank a lot for your helps and advices:

The solution was:
A) I changed the HQL-Statement to:
result = session.createQuery("select rvr from RVarRegions rvr where actStatus <> 1 ").list();

B) I changed in the Java-File the datatype from java.lang.Long to java.math.BigDecimal:

public class RVarRegions implements java.io.Serializable {
private BigDecimal actStatus;
private BigDecimal companyId;

public BigDecimal getActStatus() {
return this.actStatus;
}

public void setActStatus(BigDecimal actStatus) {
this.actStatus = actStatus;
}

public BigDecimal getCompanyId() {
return this.companyId;
}

public void setCompanyId(BigDecimal companyId) {
this.companyId = companyId;
}
}

C) Also the database driver is now changed from "COM.ibm.db2.jdbc.app.DB2Driver" to "com.ibm.db2.jcc.DB2Driver"

D) Changes in the config file of hibernate hibernate.cfg.xml
<property name="hibernate.bytecode.use_reflection_optimizer" >true</property>
...
<property name="hibernate.connection.driver_class">com.ibm.d b2.jcc.DB2Driver</property>


Thanks again for your helps & advices


Best Regards,
Kafftarbaz :-)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On