if I am using old version of hibernate , what is the correct version to use ? to avoid this error ? I am using J2sdk1.4.
thanks
Hibernate version:
2.1.2 , Jdk1.4
Mapping documents:
#hinetlogic hibernate properties
#Mon Dec 27 00:35:28 PST 2004
hibernate.connection.username=xxxx
hibernate.connection.password=xxx
hibernate.jdbc.use_scrollable_resultsets=false
hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect
hibernate.connection.url=jdbc\:db2\:sample
hibernate.use_outer_join=true
hibernate.jdbc.batch_size=0
hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.DB2Driver
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="hinetlogic.Customer" table="CUSTOMER">
<id name="id" type="integer" unsaved-value="-1">
<generator class="identity"/>
</id>
<property name="name" column="name" type="string" length="100" not-null="true"/>
<property name="customerId" column="customer_Id" type="string" length="10" not-null="true"/>
<property name="emailAdress" column="email_address" type="string" length="50" not-null="true"/>
<property name="ophone" column="office_phone" type="string" length="20" not-null="true"/>
<property name="date" column="date_entered" type="date" not-null="true"/>
<property name="hphone" column="home_phone" type="string" length="20" not-null="true"/>
<property name="stree" column="street" type="string" length="100" not-null="true"/>
<property name="state" column="state" type="string" length="20" not-null="true"/>
<property name="pcode" column="postal_code" type="string" length="10" not-null="true"/>
<property name="country" column="country" type="string" length="20" not-null="true"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
public class HibernateSession {
public static Session currentSession() throws DAOException {
Session s = (Session) session.get();
//System.err.println("after the session statement");
try {
if(s == null ||s.isOpen()== false)
{
if (sf == null)
{
try
{
//cfg.configure();
loadClasses();
sf = cfg.buildSessionFactory();
}
catch(Exception e) {
System.err.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
}
s = sf.openSession();
session.set(s);
}
}
catch (HibernateException he) {
throw new DAOException(he);
}
return s;
}
Full stack trace of any exception that occurs:
run-tests:
[junit] Running hinetlogic.test.TestCustomerDAO
[junit] 00:11:24,410 INFO Environment:462 - Hibernate 2.1.2
[junit] 00:11:24,440 INFO Environment:496 - loaded properties from resource
hibernate.properties: {hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.D
B2Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.s
f.hibernate.dialect.DB2Dialect, hibernate.jdbc.use_scrollable_resultsets=false,
hibernate.jdbc.batch_size=0, hibernate.use_outer_join=true, hibernate.connection
.username=xxxxxx, hibernate.connection.url=jdbc:db2:sample, hibernate.connection
.password=xxxx}
[junit] 00:11:24,460 INFO Environment:519 - using CGLIB reflection optimize
r
[junit] 00:11:24,480 INFO Configuration:329 - Mapping resource: hinetlogic/
Customer.hbm.xml
[junit] 00:11:26,763 INFO Binder:229 - Mapping class: hinetlogic.Customer -
> CUSTOMER
[junit] 00:11:27,074 INFO Configuration:595 - processing one-to-many associ
ation mappings
[junit] 00:11:27,084 INFO Configuration:604 - processing one-to-one associa
tion property references
[junit] 00:11:27,094 INFO Configuration:629 - processing foreign key constr
aints
[junit] 00:11:27,184 INFO Dialect:82 - Using dialect: net.sf.hibernate.dial
ect.DB2Dialect
[junit] 00:11:27,194 INFO SettingsFactory:62 - Use outer join fetching: tru
e
[junit] 00:11:27,214 INFO DriverManagerConnectionProvider:41 - Using Hibern
ate built-in connection pool (not for production use!)
[junit] 00:11:27,214 INFO DriverManagerConnectionProvider:42 - Hibernate co
nnection pool size: 20
[junit] 00:11:27,484 INFO DriverManagerConnectionProvider:71 - using driver
: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:sample
[junit] 00:11:27,484 INFO DriverManagerConnectionProvider:72 - connection p
roperties: {user=xxxx password=xxx}
[junit] 00:11:27,534 INFO TransactionManagerLookupFactory:33 - No Transacti
onManagerLookup configured (in JTA environment, use of process level read-write
cache is not recommended)
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 4.286 sec
[junit] Test hinetlogic.test.TestCustomerDAO FAILED
all:
BUILD SUCCESSFUL
Total time: 35 seconds
Testsuite: hinetlogic.test.TestCustomerDAO
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 4.917 sec
Testcase: testSaveCustomer took 4.907 sec
Caused an ERROR
COM.ibm.db2.jdbc.app.DB2DatabaseMetaData.supportsResultSetType(I)Z
java.lang.AbstractMethodError: COM.ibm.db2.jdbc.app.DB2DatabaseMetaData.supportsResultSetType(I)Z
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:75)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1119)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:748)
at hinetlogic.persistence.HibernateSession.currentSession(HibernateSession.java:26)
at hinetlogic.persistence.BaseDAO.storeObj(BaseDAO.java:90)
at hinetlogic.persistence.CustomerDAO.saveCustomer(CustomerDAO.java:10)
at hinetlogic.test.TestCustomerDAO.testSaveCustomer(TestCustomerDAO.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Testcase: testSaveCustomer
Name and version of the database you are using:
DB2 7.xx
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|