Thanks for your interest. Could anyone tell me why I am getting this exception? All I did was change a list to a set.
Code:
(cfg.Environment 464 ) Hibernate 3.0.3
(cfg.Environment 477 ) hibernate.properties not found
(cfg.Environment 510 ) using CGLIB reflection optimizer
(cfg.Environment 540 ) using JDK 1.4 java.sql.Timestamp handling
(cfg.Configuration 1194) configuring from file: hibernate.cfg.xml
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/Buyer.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.Buyer -> buyer_tbl
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/Token.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.Token -> token_tbl
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/OrderDetail.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.OrderDetail -> order_detail_tbl
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/ServiceProvider.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.ServiceProvider -> service_provider_tbl
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/Delivery.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.Delivery -> delivery_tbl
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/Order.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.Order -> order_tbl
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/Customer.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.Customer -> customer_tbl
(cfg.HbmBinder 1206) Mapping collection: za.co.easypay.easycredit.Customer.serviceProviders -> customer_sp_tbl
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/Network.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.Network -> network_tbl
(cfg.Configuration 441 ) Mapping resource: za/co/easypay/easycredit/Denomination.hbm.xml
(cfg.HbmBinder 258 ) Mapping class: za.co.easypay.easycredit.Denomination -> denomination_tbl
(cfg.Configuration 1272) Configured SessionFactory: null
(cfg.Configuration 852 ) processing extends queue
(cfg.Configuration 856 ) processing collection mappings
(cfg.HbmBinder 1998) Mapping collection: za.co.easypay.easycredit.Buyer.orders -> order_tbl
(cfg.HbmBinder 1998) Mapping collection: za.co.easypay.easycredit.ServiceProvider.networks -> network_tbl
(cfg.HbmBinder 1998) Mapping collection: za.co.easypay.easycredit.Delivery.tokens -> token_tbl
(cfg.HbmBinder 1998) Mapping collection: za.co.easypay.easycredit.Order.deliveries -> delivery_tbl
(cfg.HbmBinder 1998) Mapping collection: za.co.easypay.easycredit.Order.orderDetails -> order_detail_tbl
(cfg.HbmBinder 1998) Mapping collection: za.co.easypay.easycredit.Customer.orders -> order_tbl
(cfg.HbmBinder 1998) Mapping collection: za.co.easypay.easycredit.Network.denominations -> denomination_tbl
(cfg.Configuration 865 ) processing association property references
(cfg.Configuration 894 ) processing foreign key constraints
(connection.DriverManagerConnectionProvider 41 ) Using Hibernate built-in connection pool (not for production use!)
(connection.DriverManagerConnectionProvider 42 ) Hibernate connection pool size: 20
(connection.DriverManagerConnectionProvider 45 ) autocommit mode: false
(connection.DriverManagerConnectionProvider 80 ) using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://196.34.50.156:3306/cds2_test
(connection.DriverManagerConnectionProvider 86 ) connection properties: {user=tomcat, password=****}
(cfg.SettingsFactory 72 ) RDBMS: MySQL, version: 4.0.22
(cfg.SettingsFactory 73 ) JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.0.14-production ( $Date: 2004/04/24 15:49:43 $, $Revision: 1.27.2.39 $ )
(dialect.Dialect 92 ) Using dialect: org.hibernate.dialect.MySQLDialect
(transaction.TransactionFactoryFactory 31 ) Using default transaction strategy (direct JDBC transactions)
(transaction.TransactionManagerLookupFactory 33 ) No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
(cfg.SettingsFactory 126 ) Automatic flush during beforeCompletion(): disabled
(cfg.SettingsFactory 130 ) Automatic session close at end of transaction: disabled
(cfg.SettingsFactory 137 ) JDBC batch size: 15
(cfg.SettingsFactory 140 ) JDBC batch updates for versioned data: disabled
(cfg.SettingsFactory 145 ) Scrollable result sets: enabled
(cfg.SettingsFactory 153 ) JDBC3 getGeneratedKeys(): enabled
(cfg.SettingsFactory 161 ) Connection release mode: null
(cfg.SettingsFactory 185 ) Maximum outer join fetch depth: 2
(cfg.SettingsFactory 188 ) Default batch fetch size: 1
(cfg.SettingsFactory 192 ) Generate SQL with comments: disabled
(cfg.SettingsFactory 196 ) Order SQL updates by primary key: disabled
(cfg.SettingsFactory 321 ) Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
(ast.ASTQueryTranslatorFactory 21 ) Using ASTQueryTranslatorFactory
(cfg.SettingsFactory 204 ) Query language substitutions: {}
(cfg.SettingsFactory 210 ) Second-level cache: enabled
(cfg.SettingsFactory 214 ) Query cache: disabled
(cfg.SettingsFactory 308 ) Cache provider: org.hibernate.cache.EhCacheProvider
(cfg.SettingsFactory 229 ) Optimize cache for minimal puts: disabled
(cfg.SettingsFactory 238 ) Structured second-level cache entries: enabled
(cfg.SettingsFactory 262 ) Statistics: disabled
(cfg.SettingsFactory 266 ) Deleted entity synthetic identifier rollback: disabled
(cfg.SettingsFactory 280 ) Default entity-mode: pojo
(impl.SessionFactoryImpl 151 ) building session factory
(config.Configurator 126 ) No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/Eclipse/workspace/cds2_hibernate/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
org.hibernate.InstantiationException: could not instantiate test objectza.co.easypay.easycredit.Buyer
at org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:25)
at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:44)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:42)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:107)
at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:210)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
at za.co.easypay.easycredit.GetTest.main(GetTest.java:29)
Exception in thread "main"
//My class
Code:
package za.co.easypay.easycredit;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.*;
public class Buyer {
private String __name;
private Long __id;
private Set __orders;
public Buyer() {
}
public Long getId() {
return __id;
}
private void setId(Long id) {
__id = id;
}
public String getName() {
return __name;
}
public void setName(String name) {
__name = name;
}
public void setOrders(Set orders) {
__orders = orders;
}
public Set getOrders() {
return __orders;
}
}
//My mapping file
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
<class
name="za.co.easypay.easycredit.Buyer"
table="buyer_tbl"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>
<id
name="id"
column="buyer_id"
>
<generator class="native">
</generator>
</id>
<property
name="name"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="buyer_name"
/>
<set name="orders" inverse="false">
<key column="buyer_id"/>
<one-to-many class="za.co.easypay.easycredit.Order"/>
</set>
</class>
</hibernate-mapping>