-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to map parent child relationship.
PostPosted: Fri May 09, 2008 1:43 am 
Newbie

Joined: Mon Mar 31, 2008 10:15 am
Posts: 5
Hi,
I am trying to map two classes Organization and employee.

Organization class contains:
Integer organizationId;
String organizationName;
Set<Employee> employees=new HashSet<Employee>();
int numberOfEmployees;

And Employee class contains:
Integer employeeId;
String employeeName;
int employeeSalary;
int orgId;
Organization organization;
I can insert the data successfully but when I try to retrieve the data I get only one employee. I do not get all employees of the organization. All details of my class and mapping are as below:

Hibernate version:3

Mapping documents:

1. Oranization.hbm file

<?xml version='1.0'?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="com.sonu.pojo">
<class name="Organization" table="organization" >
<id name="organizationId" type="java.lang.Integer" column="ORGANIZATION_ID" >
<generator class="increment" />
</id>
<property name="organizationName" type="java.lang.String" column="ORGANIZATION_NAME" length="50" />


<set name="employees" inverse="true" lazy="false" fetch="join" table="employee" cascade="all">
<key column="EMPLOYEE_ID"/>
<one-to-many class="Employee" />
</set>

<property name="numberOfEmployees" type="java.lang.Integer" column="EMPLOYEES" />
</class>

</hibernate-mapping>


2. Employee.hbm file

<?xml version='1.0'?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="com.sonu.pojo">
<class name="Employee" table="employee" >
<id name="employeeId" type="java.lang.Integer" column="EMPLOYEE_ID">
<generator class="increment"/>
</id>

<property name="employeeName" type="java.lang.String" column="EMPLOYEE_NAME" length="50" />
<property name="employeeSalary" type="java.lang.Integer" column="EMPLOYEE_SALARY" />
<!-- <many-to-one name="organization" class="Organization" column="ORG_ID" update="false" outer-join="true" foreign-key="ORGANIZATION_ID"/> -->
<many-to-one name="organization" insert="true" update="true" column="ORG_ID" lazy="false" fetch="join" class="Organization" not-null="true"/>
</class>

</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():


public class OrganizationDAO {
private Manager m_manager=new Manager();
private Organization m_organization;
private Session m_session;
private static OrganizationDAO m_organizationDAO;
private static Logger m_logger=Logger.getLogger(OrganizationDAO.class);
private OrganizationDAO(){
if(m_session==null){
m_session=m_manager.getSession();
}
}
public static OrganizationDAO getInstance(){
if(m_organizationDAO==null){
m_organizationDAO=new OrganizationDAO();

}
return m_organizationDAO;
}
public Organization buildOrganization(String p_name){
m_organization=new Organization();
m_organization.setOrganizationName(p_name);
return m_organization;
}

public boolean insertOrganization(Organization p_organization){
boolean isInserted=false;
try{
Transaction tx=m_session.beginTransaction();
m_logger.debug("Transaction has begun");

m_session.save(p_organization);
tx.commit();
m_logger.debug("Transaction has completed");
isInserted=true;
}catch(HibernateException ex){
m_logger.error("Transaction has not completed due to\n"+ex);
}

return isInserted;
}

public Organization retriveOrganizationById(int id){
m_organization=(Organization) m_session.load(Organization.class, new Integer(id));
return m_organization;
}
}

Full stack trace of any exception that occurs:
There is no exception thrown by the application.
Name and version of the database you are using:
I am using using MySql 5.0
The generated SQL (show_sql=true):


Debug level Hibernate log excerpt:
2008-05-09 11:08:46,079 (Environment.java:500) INFO - Hibernate 3.2 cr3
2008-05-09 11:08:46,126 (Environment.java:533) INFO - hibernate.properties not found
2008-05-09 11:08:46,157 (Environment.java:667) INFO - Bytecode provider name : cglib
2008-05-09 11:08:46,204 (Environment.java:584) INFO - using JDK 1.4 java.sql.Timestamp handling
2008-05-09 11:08:46,423 (Configuration.java:1350) INFO - configuring from resource: /hibernate.cfg.xml
2008-05-09 11:08:46,439 (Configuration.java:1327) INFO - Configuration resource: /hibernate.cfg.xml
2008-05-09 11:08:46,767 (DTDEntityResolver.java:38) DEBUG - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
2008-05-09 11:08:46,767 (DTDEntityResolver.java:40) DEBUG - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2008-05-09 11:08:46,782 (DTDEntityResolver.java:50) DEBUG - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
2008-05-09 11:08:46,861 (Configuration.java:1311) DEBUG - connection.url=jdbc:mysql://localhost:3306/mydatabase
2008-05-09 11:08:46,861 (Configuration.java:1311) DEBUG - connection.driver_class=com.mysql.jdbc.Driver
2008-05-09 11:08:46,876 (Configuration.java:1311) DEBUG - connection.username=root
2008-05-09 11:08:46,876 (Configuration.java:1311) DEBUG - connection.password=admin
2008-05-09 11:08:46,876 (Configuration.java:1311) DEBUG - connection.autocommit=true
2008-05-09 11:08:46,876 (Configuration.java:1311) DEBUG - show_sql=true
2008-05-09 11:08:46,907 (Configuration.java:1311) DEBUG - dialect=org.hibernate.dialect.MySQLDialect
2008-05-09 11:08:46,907 (Configuration.java:1510) DEBUG - null<-org.dom4j.tree.DefaultAttribute@1546e25 [Attribute: name resource value "com/sonu/pojo/Organization.hbm.xml"]
2008-05-09 11:08:46,907 (Configuration.java:507) INFO - Reading mappings from resource: com/sonu/pojo/Organization.hbm.xml
2008-05-09 11:08:46,923 (DTDEntityResolver.java:38) DEBUG - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
2008-05-09 11:08:46,939 (DTDEntityResolver.java:40) DEBUG - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2008-05-09 11:08:46,939 (DTDEntityResolver.java:50) DEBUG - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
2008-05-09 11:08:47,251 (HbmBinder.java:299) INFO - Mapping class: com.sonu.pojo.Organization -> organization
2008-05-09 11:08:47,267 (HbmBinder.java:1269) DEBUG - Mapped property: organizationId -> ORGANIZATION_ID
2008-05-09 11:08:47,282 (HbmBinder.java:1269) DEBUG - Mapped property: organizationName -> ORGANIZATION_NAME
2008-05-09 11:08:47,298 (HbmBinder.java:1269) DEBUG - Mapped property: employees
2008-05-09 11:08:47,298 (HbmBinder.java:1269) DEBUG - Mapped property: numberOfEmployees -> EMPLOYEES
2008-05-09 11:08:47,298 (Configuration.java:1510) DEBUG - null<-org.dom4j.tree.DefaultAttribute@e3b895 [Attribute: name resource value "com/sonu/pojo/Employee.hbm.xml"]
2008-05-09 11:08:47,314 (Configuration.java:507) INFO - Reading mappings from resource: com/sonu/pojo/Employee.hbm.xml
2008-05-09 11:08:47,329 (DTDEntityResolver.java:38) DEBUG - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
2008-05-09 11:08:47,329 (DTDEntityResolver.java:40) DEBUG - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2008-05-09 11:08:47,329 (DTDEntityResolver.java:50) DEBUG - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
2008-05-09 11:08:47,423 (HbmBinder.java:299) INFO - Mapping class: com.sonu.pojo.Employee -> employee
2008-05-09 11:08:47,423 (HbmBinder.java:1269) DEBUG - Mapped property: employeeId -> EMPLOYEE_ID
2008-05-09 11:08:47,423 (HbmBinder.java:1269) DEBUG - Mapped property: employeeName -> EMPLOYEE_NAME
2008-05-09 11:08:47,439 (HbmBinder.java:1269) DEBUG - Mapped property: employeeSalary -> EMPLOYEE_SALARY
2008-05-09 11:08:47,642 (HbmBinder.java:1269) DEBUG - Mapped property: organization -> ORG_ID
2008-05-09 11:08:47,657 (Configuration.java:1465) INFO - Configured SessionFactory: null
2008-05-09 11:08:47,657 (Configuration.java:1466) DEBUG - properties: {hibernate.connection.password=admin, java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=C:\Program Files\Java\jdk1.6.0\jre\bin, java.vm.version=1.6.0-b105, hibernate.connection.username=root, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\NetBeansWorkspace\BookProjectInHibernate, java.runtime.version=1.6.0-b105, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files\Java\jdk1.6.0\jre\lib\endorsed, os.arch=x86, hibernate.connection.autocommit=true, java.io.tmpdir=C:\DOCUME~1\UMASHA~1.SHA\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, log4j.configuration=BookProjectInHibernate-log4j.properties, sun.jnu.encoding=Cp1252, java.library.path=C:\Program Files\Java\jdk1.6.0\jre\bin;.;C:\WINNT\Sun\Java\bin;C:\WINNT\system32;C:\WINNT;D:\oracle\product\10.2.0\client_1\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Java\jdk1.6.0\bin;C:\PROGRA~1\cvsnt;D:\Java\Python;C:\Program Files\JProbe 7.0\bin;C:\apache-ant-1.6.5\bin;C:\Program Files\Java\jdk1.6.0;C:\Program Files\CVSNT\, java.specification.name=Java Platform API Specification, java.class.version=50.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.0, connection.password=admin, user.home=C:\Documents and Settings\umashankar.sharma, user.timezone=GMT+05:30, connection.username=root, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.6, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, java.class.path=C:\NetBeansWorkspace\BookProjectInHibernate\lib\antlr-2.7.6.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\asm-attrs.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\asm.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\cglib-2.1.3.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\commons-collections-2.1.1.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\commons-logging-1.0.4.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\dom4j-1.6.1.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\hibernate3.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\jta.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\log4j-1.2.11.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\mysql-connector-java-3.1.13-bin.jar;C:\NetBeansWorkspace\BookProjectInHibernate\config;C:\NetBeansWorkspace\BookProjectInHibernate\build\classes, user.name=umashankar.sharma, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\Program Files\Java\jdk1.6.0\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://localhost:3306/mydatabase, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, sharing, java.version=1.6.0, java.ext.dirs=C:\Program Files\Java\jdk1.6.0\jre\lib\ext;C:\WINNT\Sun\Java\lib\ext, sun.boot.class.path=C:\Program Files\Java\jdk1.6.0\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0\jre\classes, java.vendor=Sun Microsystems Inc., connection.driver_class=com.mysql.jdbc.Driver, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, connection.autocommit=true, sun.desktop=windows, connection.url=jdbc:mysql://localhost:3306/mydatabase, dialect=org.hibernate.dialect.MySQLDialect, sun.cpu.isalist=}
2008-05-09 11:08:47,673 (Configuration.java:1209) DEBUG - Preparing to build session factory with filters : {}
2008-05-09 11:08:47,673 (Configuration.java:1044) DEBUG - processing extends queue
2008-05-09 11:08:47,673 (Configuration.java:1048) DEBUG - processing collection mappings
2008-05-09 11:08:47,673 (CollectionSecondPass.java:33) DEBUG - Second pass for collection: com.sonu.pojo.Organization.employees
2008-05-09 11:08:47,689 (HbmBinder.java:2363) INFO - Mapping collection: com.sonu.pojo.Organization.employees -> employee
2008-05-09 11:08:47,689 (CollectionSecondPass.java:49) DEBUG - Mapped collection key: EMPLOYEE_ID, one-to-many: com.sonu.pojo.Employee
2008-05-09 11:08:47,689 (Configuration.java:1059) DEBUG - processing native query and ResultSetMapping mappings
2008-05-09 11:08:47,689 (Configuration.java:1067) DEBUG - processing association property references
2008-05-09 11:08:47,689 (Configuration.java:1089) DEBUG - processing foreign key constraints
2008-05-09 11:08:47,689 (Configuration.java:1172) DEBUG - resolving reference to class: com.sonu.pojo.Organization
2008-05-09 11:08:47,720 (Configuration.java:1172) DEBUG - resolving reference to class: com.sonu.pojo.Organization
2008-05-09 11:08:47,751 (DriverManagerConnectionProvider.java:41) INFO - Using Hibernate built-in connection pool (not for production use!)
2008-05-09 11:08:47,751 (DriverManagerConnectionProvider.java:42) INFO - Hibernate connection pool size: 20
2008-05-09 11:08:47,767 (DriverManagerConnectionProvider.java:45) INFO - autocommit mode: true
2008-05-09 11:08:47,782 (DriverManagerConnectionProvider.java:80) INFO - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/mydatabase
2008-05-09 11:08:47,782 (DriverManagerConnectionProvider.java:83) INFO - connection properties: {user=root, password=admin, autocommit=true}
2008-05-09 11:08:47,798 (DriverManagerConnectionProvider.java:93) DEBUG - total checked-out connections: 0
2008-05-09 11:08:47,814 (DriverManagerConnectionProvider.java:109) DEBUG - opening new JDBC connection
2008-05-09 11:08:49,001 (DriverManagerConnectionProvider.java:115) DEBUG - created connection to: jdbc:mysql://localhost:3306/mydatabase, Isolation Level: 4
2008-05-09 11:08:49,001 (SettingsFactory.java:81) INFO - RDBMS: MySQL, version: 5.0.15-nt
2008-05-09 11:08:49,017 (SettingsFactory.java:82) INFO - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.13 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )
2008-05-09 11:08:49,017 (DriverManagerConnectionProvider.java:129) DEBUG - returning connection to pool, pool size: 1
2008-05-09 11:08:49,095 (Dialect.java:141) INFO - Using dialect: org.hibernate.dialect.MySQLDialect
2008-05-09 11:08:49,111 (TransactionFactoryFactory.java:31) INFO - Using default transaction strategy (direct JDBC transactions)
2008-05-09 11:08:49,111 (TransactionManagerLookupFactory.java:33) INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2008-05-09 11:08:49,111 (SettingsFactory.java:134) INFO - Automatic flush during beforeCompletion(): disabled
2008-05-09 11:08:49,111 (SettingsFactory.java:138) INFO - Automatic session close at end of transaction: disabled
2008-05-09 11:08:49,126 (SettingsFactory.java:145) INFO - JDBC batch size: 15
2008-05-09 11:08:49,126 (SettingsFactory.java:148) INFO - JDBC batch updates for versioned data: disabled
2008-05-09 11:08:49,126 (SettingsFactory.java:153) INFO - Scrollable result sets: enabled
2008-05-09 11:08:49,126 (SettingsFactory.java:157) DEBUG - Wrap result sets: disabled
2008-05-09 11:08:49,126 (SettingsFactory.java:161) INFO - JDBC3 getGeneratedKeys(): enabled
2008-05-09 11:08:49,126 (SettingsFactory.java:169) INFO - Connection release mode: auto
2008-05-09 11:08:49,173 (SettingsFactory.java:193) INFO - Maximum outer join fetch depth: 2
2008-05-09 11:08:49,189 (SettingsFactory.java:196) INFO - Default batch fetch size: 1
2008-05-09 11:08:49,189 (SettingsFactory.java:200) INFO - Generate SQL with comments: disabled
2008-05-09 11:08:49,189 (SettingsFactory.java:204) INFO - Order SQL updates by primary key: disabled
2008-05-09 11:08:49,189 (SettingsFactory.java:369) INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2008-05-09 11:08:49,204 (ASTQueryTranslatorFactory.java:24) INFO - Using ASTQueryTranslatorFactory
2008-05-09 11:08:49,204 (SettingsFactory.java:212) INFO - Query language substitutions: {}
2008-05-09 11:08:49,220 (SettingsFactory.java:217) INFO - JPA-QL strict compliance: disabled
2008-05-09 11:08:49,220 (SettingsFactory.java:222) INFO - Second-level cache: enabled
2008-05-09 11:08:49,220 (SettingsFactory.java:226) INFO - Query cache: disabled
2008-05-09 11:08:49,220 (SettingsFactory.java:356) INFO - Cache provider: org.hibernate.cache.NoCacheProvider
2008-05-09 11:08:49,220 (SettingsFactory.java:241) INFO - Optimize cache for minimal puts: disabled
2008-05-09 11:08:49,220 (SettingsFactory.java:250) INFO - Structured second-level cache entries: disabled
2008-05-09 11:08:49,220 (SQLExceptionConverterFactory.java:52) DEBUG - Using dialect defined converter
2008-05-09 11:08:49,236 (SettingsFactory.java:270) INFO - Echoing all SQL to stdout
2008-05-09 11:08:49,236 (SettingsFactory.java:277) INFO - Statistics: disabled
2008-05-09 11:08:49,236 (SettingsFactory.java:281) INFO - Deleted entity synthetic identifier rollback: disabled
2008-05-09 11:08:49,236 (SettingsFactory.java:296) INFO - Default entity-mode: pojo
2008-05-09 11:08:49,376 (SessionFactoryImpl.java:161) INFO - building session factory
2008-05-09 11:08:49,376 (SessionFactoryImpl.java:173) DEBUG - Session factory constructed with filter configurations : {}
2008-05-09 11:08:49,392 (SessionFactoryImpl.java:177) DEBUG - instantiating session factory with properties: {java.runtime.name=Java(TM) SE Runtime Environment, hibernate.connection.password=admin, sun.boot.library.path=C:\Program Files\Java\jdk1.6.0\jre\bin, java.vm.version=1.6.0-b105, hibernate.connection.username=root, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\NetBeansWorkspace\BookProjectInHibernate, java.runtime.version=1.6.0-b105, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files\Java\jdk1.6.0\jre\lib\endorsed, os.arch=x86, hibernate.connection.autocommit=true, java.io.tmpdir=C:\DOCUME~1\UMASHA~1.SHA\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, log4j.configuration=BookProjectInHibernate-log4j.properties, sun.jnu.encoding=Cp1252, java.library.path=C:\Program Files\Java\jdk1.6.0\jre\bin;.;C:\WINNT\Sun\Java\bin;C:\WINNT\system32;C:\WINNT;D:\oracle\product\10.2.0\client_1\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Java\jdk1.6.0\bin;C:\PROGRA~1\cvsnt;D:\Java\Python;C:\Program Files\JProbe 7.0\bin;C:\apache-ant-1.6.5\bin;C:\Program Files\Java\jdk1.6.0;C:\Program Files\CVSNT\, java.specification.name=Java Platform API Specification, java.class.version=50.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.0, user.home=C:\Documents and Settings\umashankar.sharma, connection.password=admin, user.timezone=GMT+05:30, java.awt.printerjob=sun.awt.windows.WPrinterJob, connection.username=root, java.specification.version=1.6, file.encoding=Cp1252, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, user.name=umashankar.sharma, java.class.path=C:\NetBeansWorkspace\BookProjectInHibernate\lib\antlr-2.7.6.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\asm-attrs.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\asm.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\cglib-2.1.3.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\commons-collections-2.1.1.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\commons-logging-1.0.4.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\dom4j-1.6.1.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\hibernate3.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\jta.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\log4j-1.2.11.jar;C:\NetBeansWorkspace\BookProjectInHibernate\lib\mysql-connector-java-3.1.13-bin.jar;C:\NetBeansWorkspace\BookProjectInHibernate\config;C:\NetBeansWorkspace\BookProjectInHibernate\build\classes, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\Program Files\Java\jdk1.6.0\jre, hibernate.connection.url=jdbc:mysql://localhost:3306/mydatabase, hibernate.dialect=org.hibernate.dialect.MySQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=en, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, sharing, java.version=1.6.0, java.ext.dirs=C:\Program Files\Java\jdk1.6.0\jre\lib\ext;C:\WINNT\Sun\Java\lib\ext, sun.boot.class.path=C:\Program Files\Java\jdk1.6.0\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0\jre\classes, java.vendor=Sun Microsystems Inc., file.separator=\, connection.driver_class=com.mysql.jdbc.Driver, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, connection.autocommit=true, sun.desktop=windows, connection.url=jdbc:mysql://localhost:3306/mydatabase, sun.cpu.isalist=, dialect=org.hibernate.dialect.MySQLDialect}
2008-05-09 11:08:50,048 (AbstractEntityPersister.java:2557) DEBUG - Static SQL for entity: com.sonu.pojo.Employee
2008-05-09 11:08:50,048 (AbstractEntityPersister.java:2562) DEBUG - Version select: select EMPLOYEE_ID from employee where EMPLOYEE_ID =?
2008-05-09 11:08:50,048 (AbstractEntityPersister.java:2565) DEBUG - Snapshot select: select employee_.EMPLOYEE_ID, employee_.EMPLOYEE_NAME as EMPLOYEE2_1_, employee_.EMPLOYEE_SALARY as EMPLOYEE3_1_, employee_.ORG_ID as ORG4_1_ from employee employee_ where employee_.EMPLOYEE_ID=?
2008-05-09 11:08:50,048 (AbstractEntityPersister.java:2568) DEBUG - Insert 0: insert into employee (EMPLOYEE_NAME, EMPLOYEE_SALARY, ORG_ID, EMPLOYEE_ID) values (?, ?, ?, ?)
2008-05-09 11:08:50,048 (AbstractEntityPersister.java:2569) DEBUG - Update 0: update employee set EMPLOYEE_NAME=?, EMPLOYEE_SALARY=?, ORG_ID=? where EMPLOYEE_ID=?
2008-05-09 11:08:50,048 (AbstractEntityPersister.java:2570) DEBUG - Delete 0: delete from employee where EMPLOYEE_ID=?
2008-05-09 11:08:50,079 (AbstractEntityPersister.java:2557) DEBUG - Static SQL for entity: com.sonu.pojo.Organization
2008-05-09 11:08:50,079 (AbstractEntityPersister.java:2562) DEBUG - Version select: select ORGANIZATION_ID from organization where ORGANIZATION_ID =?
2008-05-09 11:08:50,079 (AbstractEntityPersister.java:2565) DEBUG - Snapshot select: select organizati_.ORGANIZATION_ID, organizati_.ORGANIZATION_NAME as ORGANIZA2_0_, organizati_.EMPLOYEES as EMPLOYEES0_ from organization organizati_ where organizati_.ORGANIZATION_ID=?
2008-05-09 11:08:50,079 (AbstractEntityPersister.java:2568) DEBUG - Insert 0: insert into organization (ORGANIZATION_NAME, EMPLOYEES, ORGANIZATION_ID) values (?, ?, ?)
2008-05-09 11:08:50,079 (AbstractEntityPersister.java:2569) DEBUG - Update 0: update organization set ORGANIZATION_NAME=?, EMPLOYEES=? where ORGANIZATION_ID=?
2008-05-09 11:08:50,095 (AbstractEntityPersister.java:2570) DEBUG - Delete 0: delete from organization where ORGANIZATION_ID=?
2008-05-09 11:08:50,111 (AbstractCollectionPersister.java:546) DEBUG - Static SQL for collection: com.sonu.pojo.Organization.employees
2008-05-09 11:08:50,126 (AbstractCollectionPersister.java:548) DEBUG - Row insert: update employee set EMPLOYEE_ID=? where EMPLOYEE_ID=?
2008-05-09 11:08:50,126 (AbstractCollectionPersister.java:554) DEBUG - Row delete: update employee set EMPLOYEE_ID=null where EMPLOYEE_ID=? and EMPLOYEE_ID=?
2008-05-09 11:08:50,126 (AbstractCollectionPersister.java:557) DEBUG - One-shot delete: update employee set EMPLOYEE_ID=null where EMPLOYEE_ID=?
2008-05-09 11:08:50,173 (EntityLoader.java:79) DEBUG - Static select for entity com.sonu.pojo.Employee: select employee0_.EMPLOYEE_ID as EMPLOYEE1_1_2_, employee0_.EMPLOYEE_NAME as EMPLOYEE2_1_2_, employee0_.EMPLOYEE_SALARY as EMPLOYEE3_1_2_, employee0_.ORG_ID as ORG4_1_2_, organizati1_.ORGANIZATION_ID as ORGANIZA1_0_0_, organizati1_.ORGANIZATION_NAME as ORGANIZA2_0_0_, organizati1_.EMPLOYEES as EMPLOYEES0_0_, employees2_.EMPLOYEE_ID as EMPLOYEE1_4_, employees2_.EMPLOYEE_ID as EMPLOYEE1_1_1_, employees2_.EMPLOYEE_NAME as EMPLOYEE2_1_1_, employees2_.EMPLOYEE_SALARY as EMPLOYEE3_1_1_, employees2_.ORG_ID as ORG4_1_1_ from employee employee0_ inner join organization organizati1_ on employee0_.ORG_ID=organizati1_.ORGANIZATION_ID left outer join employee employees2_ on organizati1_.ORGANIZATION_ID=employees2_.EMPLOYEE_ID where employee0_.EMPLOYEE_ID=?
2008-05-09 11:08:50,189 (EntityLoader.java:79) DEBUG - Static select for entity com.sonu.pojo.Employee: select employee0_.EMPLOYEE_ID as EMPLOYEE1_1_2_, employee0_.EMPLOYEE_NAME as EMPLOYEE2_1_2_, employee0_.EMPLOYEE_SALARY as EMPLOYEE3_1_2_, employee0_.ORG_ID as ORG4_1_2_, organizati1_.ORGANIZATION_ID as ORGANIZA1_0_0_, organizati1_.ORGANIZATION_NAME as ORGANIZA2_0_0_, organizati1_.EMPLOYEES as EMPLOYEES0_0_, employees2_.EMPLOYEE_ID as EMPLOYEE1_4_, employees2_.EMPLOYEE_ID as EMPLOYEE1_1_1_, employees2_.EMPLOYEE_NAME as EMPLOYEE2_1_1_, employees2_.EMPLOYEE_SALARY as EMPLOYEE3_1_1_, employees2_.ORG_ID as ORG4_1_1_ from employee employee0_ inner join organization organizati1_ on employee0_.ORG_ID=organizati1_.ORGANIZATION_ID left outer join employee employees2_ on organizati1_.ORGANIZATION_ID=employees2_.EMPLOYEE_ID where employee0_.EMPLOYEE_ID=?
2008-05-09 11:08:50,189 (EntityLoader.java:79) DEBUG - Static select for entity com.sonu.pojo.Employee: select employee0_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employee0_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employee0_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employee0_.ORG_ID as ORG4_1_0_ from employee employee0_ where employee0_.EMPLOYEE_ID=? for update
2008-05-09 11:08:50,189 (EntityLoader.java:79) DEBUG - Static select for entity com.sonu.pojo.Employee: select employee0_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employee0_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employee0_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employee0_.ORG_ID as ORG4_1_0_ from employee employee0_ where employee0_.EMPLOYEE_ID=? for update
2008-05-09 11:08:50,236 (CascadeEntityLoader.java:34) DEBUG - Static select for action ACTION_MERGE on entity com.sonu.pojo.Employee: select employee0_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employee0_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employee0_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employee0_.ORG_ID as ORG4_1_0_ from employee employee0_ where employee0_.EMPLOYEE_ID=?
2008-05-09 11:08:50,251 (CascadeEntityLoader.java:34) DEBUG - Static select for action ACTION_REFRESH on entity com.sonu.pojo.Employee: select employee0_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employee0_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employee0_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employee0_.ORG_ID as ORG4_1_0_ from employee employee0_ where employee0_.EMPLOYEE_ID=?
2008-05-09 11:08:50,251 (EntityLoader.java:79) DEBUG - Static select for entity com.sonu.pojo.Organization: select organizati0_.ORGANIZATION_ID as ORGANIZA1_0_2_, organizati0_.ORGANIZATION_NAME as ORGANIZA2_0_2_, organizati0_.EMPLOYEES as EMPLOYEES0_2_, employees1_.EMPLOYEE_ID as EMPLOYEE1_4_, employees1_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employees1_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employees1_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employees1_.ORG_ID as ORG4_1_0_, organizati2_.ORGANIZATION_ID as ORGANIZA1_0_1_, organizati2_.ORGANIZATION_NAME as ORGANIZA2_0_1_, organizati2_.EMPLOYEES as EMPLOYEES0_1_ from organization organizati0_ left outer join employee employees1_ on organizati0_.ORGANIZATION_ID=employees1_.EMPLOYEE_ID left outer join organization organizati2_ on employees1_.ORG_ID=organizati2_.ORGANIZATION_ID where organizati0_.ORGANIZATION_ID=?
2008-05-09 11:08:50,251 (EntityLoader.java:79) DEBUG - Static select for entity com.sonu.pojo.Organization: select organizati0_.ORGANIZATION_ID as ORGANIZA1_0_2_, organizati0_.ORGANIZATION_NAME as ORGANIZA2_0_2_, organizati0_.EMPLOYEES as EMPLOYEES0_2_, employees1_.EMPLOYEE_ID as EMPLOYEE1_4_, employees1_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employees1_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employees1_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employees1_.ORG_ID as ORG4_1_0_, organizati2_.ORGANIZATION_ID as ORGANIZA1_0_1_, organizati2_.ORGANIZATION_NAME as ORGANIZA2_0_1_, organizati2_.EMPLOYEES as EMPLOYEES0_1_ from organization organizati0_ left outer join employee employees1_ on organizati0_.ORGANIZATION_ID=employees1_.EMPLOYEE_ID left outer join organization organizati2_ on employees1_.ORG_ID=organizati2_.ORGANIZATION_ID where organizati0_.ORGANIZATION_ID=?
2008-05-09 11:08:50,251 (EntityLoader.java:79) DEBUG - Static select for entity com.sonu.pojo.Organization: select organizati0_.ORGANIZATION_ID as ORGANIZA1_0_0_, organizati0_.ORGANIZATION_NAME as ORGANIZA2_0_0_, organizati0_.EMPLOYEES as EMPLOYEES0_0_ from organization organizati0_ where organizati0_.ORGANIZATION_ID=? for update
2008-05-09 11:08:50,267 (EntityLoader.java:79) DEBUG - Static select for entity com.sonu.pojo.Organization: select organizati0_.ORGANIZATION_ID as ORGANIZA1_0_0_, organizati0_.ORGANIZATION_NAME as ORGANIZA2_0_0_, organizati0_.EMPLOYEES as EMPLOYEES0_0_ from organization organizati0_ where organizati0_.ORGANIZATION_ID=? for update
2008-05-09 11:08:50,267 (CascadeEntityLoader.java:34) DEBUG - Static select for action ACTION_MERGE on entity com.sonu.pojo.Organization: select organizati0_.ORGANIZATION_ID as ORGANIZA1_0_1_, organizati0_.ORGANIZATION_NAME as ORGANIZA2_0_1_, organizati0_.EMPLOYEES as EMPLOYEES0_1_, employees1_.EMPLOYEE_ID as EMPLOYEE1_3_, employees1_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employees1_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employees1_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employees1_.ORG_ID as ORG4_1_0_ from organization organizati0_ left outer join employee employees1_ on organizati0_.ORGANIZATION_ID=employees1_.EMPLOYEE_ID where organizati0_.ORGANIZATION_ID=?
2008-05-09 11:08:50,267 (CascadeEntityLoader.java:34) DEBUG - Static select for action ACTION_REFRESH on entity com.sonu.pojo.Organization: select organizati0_.ORGANIZATION_ID as ORGANIZA1_0_1_, organizati0_.ORGANIZATION_NAME as ORGANIZA2_0_1_, organizati0_.EMPLOYEES as EMPLOYEES0_1_, employees1_.EMPLOYEE_ID as EMPLOYEE1_3_, employees1_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employees1_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employees1_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employees1_.ORG_ID as ORG4_1_0_ from organization organizati0_ left outer join employee employees1_ on organizati0_.ORGANIZATION_ID=employees1_.EMPLOYEE_ID where organizati0_.ORGANIZATION_ID=?
2008-05-09 11:08:50,283 (OneToManyLoader.java:64) DEBUG - Static select for one-to-many com.sonu.pojo.Organization.employees: select employees0_.EMPLOYEE_ID as EMPLOYEE1_2_, employees0_.EMPLOYEE_ID as EMPLOYEE1_1_1_, employees0_.EMPLOYEE_NAME as EMPLOYEE2_1_1_, employees0_.EMPLOYEE_SALARY as EMPLOYEE3_1_1_, employees0_.ORG_ID as ORG4_1_1_, organizati1_.ORGANIZATION_ID as ORGANIZA1_0_0_, organizati1_.ORGANIZATION_NAME as ORGANIZA2_0_0_, organizati1_.EMPLOYEES as EMPLOYEES0_0_ from employee employees0_ inner join organization organizati1_ on employees0_.ORG_ID=organizati1_.ORGANIZATION_ID where employees0_.EMPLOYEE_ID=?
2008-05-09 11:08:50,314 (SessionFactoryObjectFactory.java:39) DEBUG - initializing class SessionFactoryObjectFactory
2008-05-09 11:08:50,314 (SessionFactoryObjectFactory.java:76) DEBUG - registered: 40288c1819cc30530119cc30572b0000 (unnamed)
2008-05-09 11:08:50,329 (SessionFactoryObjectFactory.java:82) INFO - Not binding factory to JNDI, no JNDI name configured
2008-05-09 11:08:50,329 (SessionFactoryImpl.java:308) DEBUG - instantiated session factory
2008-05-09 11:08:50,329 (SessionFactoryImpl.java:390) DEBUG - Checking 0 named HQL queries
2008-05-09 11:08:50,329 (SessionFactoryImpl.java:410) DEBUG - Checking 0 named SQL queries
2008-05-09 11:08:50,329 (Manager.java:26) DEBUG - Session factory has created.
2008-05-09 11:08:50,329 (Manager.java:27) ERROR - Session factory has created.
2008-05-09 11:08:50,439 (SessionImpl.java:220) DEBUG - opened session at timestamp: 12103115303
2008-05-09 11:08:50,439 (DefaultLoadEventListener.java:169) DEBUG - loading entity: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,439 (DefaultLoadEventListener.java:253) DEBUG - creating new proxy for entity
2008-05-09 11:08:50,548 (JDBCContext.java:233) DEBUG - after autocommit
2008-05-09 11:08:50,548 (ConnectionManager.java:398) DEBUG - aggressively releasing JDBC connection
2008-05-09 11:08:50,548 (SessionImpl.java:422) DEBUG - after transaction completion
2008-05-09 11:08:50,548 (SessionImpl.java:832) DEBUG - initializing proxy: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,548 (DefaultLoadEventListener.java:328) DEBUG - attempting to resolve: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,548 (DefaultLoadEventListener.java:368) DEBUG - object not resolved in any cache: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,548 (AbstractEntityPersister.java:2848) DEBUG - Fetching entity: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,548 (Loader.java:1776) DEBUG - loading entity: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,564 (AbstractBatcher.java:358) DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2008-05-09 11:08:50,564 (ConnectionManager.java:415) DEBUG - opening JDBC connection
2008-05-09 11:08:50,564 (DriverManagerConnectionProvider.java:93) DEBUG - total checked-out connections: 0
2008-05-09 11:08:50,564 (DriverManagerConnectionProvider.java:99) DEBUG - using pooled JDBC connection, pool size: 0
2008-05-09 11:08:50,595 (AbstractBatcher.java:393) DEBUG - select organizati0_.ORGANIZATION_ID as ORGANIZA1_0_2_, organizati0_.ORGANIZATION_NAME as ORGANIZA2_0_2_, organizati0_.EMPLOYEES as EMPLOYEES0_2_, employees1_.EMPLOYEE_ID as EMPLOYEE1_4_, employees1_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employees1_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employees1_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employees1_.ORG_ID as ORG4_1_0_, organizati2_.ORGANIZATION_ID as ORGANIZA1_0_1_, organizati2_.ORGANIZATION_NAME as ORGANIZA2_0_1_, organizati2_.EMPLOYEES as EMPLOYEES0_1_ from organization organizati0_ left outer join employee employees1_ on organizati0_.ORGANIZATION_ID=employees1_.EMPLOYEE_ID left outer join organization organizati2_ on employees1_.ORG_ID=organizati2_.ORGANIZATION_ID where organizati0_.ORGANIZATION_ID=?
Hibernate: select organizati0_.ORGANIZATION_ID as ORGANIZA1_0_2_, organizati0_.ORGANIZATION_NAME as ORGANIZA2_0_2_, organizati0_.EMPLOYEES as EMPLOYEES0_2_, employees1_.EMPLOYEE_ID as EMPLOYEE1_4_, employees1_.EMPLOYEE_ID as EMPLOYEE1_1_0_, employees1_.EMPLOYEE_NAME as EMPLOYEE2_1_0_, employees1_.EMPLOYEE_SALARY as EMPLOYEE3_1_0_, employees1_.ORG_ID as ORG4_1_0_, organizati2_.ORGANIZATION_ID as ORGANIZA1_0_1_, organizati2_.ORGANIZATION_NAME as ORGANIZA2_0_1_, organizati2_.EMPLOYEES as EMPLOYEES0_1_ from organization organizati0_ left outer join employee employees1_ on organizati0_.ORGANIZATION_ID=employees1_.EMPLOYEE_ID left outer join organization organizati2_ on employees1_.ORG_ID=organizati2_.ORGANIZATION_ID where organizati0_.ORGANIZATION_ID=?
2008-05-09 11:08:50,595 (AbstractBatcher.java:476) DEBUG - preparing statement
2008-05-09 11:08:50,736 (NullableType.java:80) DEBUG - binding '1' to parameter: 1
2008-05-09 11:08:50,751 (AbstractBatcher.java:374) DEBUG - about to open ResultSet (open ResultSets: 0, globally: 0)
2008-05-09 11:08:50,751 (Loader.java:682) DEBUG - processing result set
2008-05-09 11:08:50,751 (Loader.java:687) DEBUG - result set row: 0
2008-05-09 11:08:50,751 (NullableType.java:122) DEBUG - returning '1' as column: EMPLOYEE1_1_0_
2008-05-09 11:08:50,751 (NullableType.java:122) DEBUG - returning '1' as column: ORGANIZA1_0_1_
2008-05-09 11:08:50,751 (Loader.java:1164) DEBUG - result row: EntityKey[com.sonu.pojo.Employee#1], EntityKey[com.sonu.pojo.Organization#1], EntityKey[com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,767 (Loader.java:1346) DEBUG - Initializing object from ResultSet: [com.sonu.pojo.Employee#1]
2008-05-09 11:08:50,798 (AbstractEntityPersister.java:1950) DEBUG - Hydrating entity: [com.sonu.pojo.Employee#1]
2008-05-09 11:08:50,798 (NullableType.java:122) DEBUG - returning 'Sandesh' as column: EMPLOYEE2_1_0_
2008-05-09 11:08:50,798 (NullableType.java:122) DEBUG - returning '20' as column: EMPLOYEE3_1_0_
2008-05-09 11:08:50,798 (NullableType.java:122) DEBUG - returning '1' as column: ORG4_1_0_
2008-05-09 11:08:50,798 (Loader.java:1346) DEBUG - Initializing object from ResultSet: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,814 (AbstractEntityPersister.java:1950) DEBUG - Hydrating entity: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,814 (NullableType.java:122) DEBUG - returning 'myOrganization' as column: ORGANIZA2_0_1_
2008-05-09 11:08:50,814 (NullableType.java:122) DEBUG - returning '2' as column: EMPLOYEES0_1_
2008-05-09 11:08:50,814 (NullableType.java:122) DEBUG - returning '1' as column: EMPLOYEE1_4_
2008-05-09 11:08:50,814 (Loader.java:972) DEBUG - found row of collection: [com.sonu.pojo.Organization.employees#1]
2008-05-09 11:08:50,829 (CollectionLoadContext.java:100) DEBUG - new collection: instantiating
2008-05-09 11:08:50,845 (NullableType.java:122) DEBUG - returning '1' as column: EMPLOYEE1_4_
2008-05-09 11:08:50,845 (DefaultLoadEventListener.java:169) DEBUG - loading entity: [com.sonu.pojo.Employee#1]
2008-05-09 11:08:50,845 (DefaultLoadEventListener.java:328) DEBUG - attempting to resolve: [com.sonu.pojo.Employee#1]
2008-05-09 11:08:50,845 (DefaultLoadEventListener.java:341) DEBUG - resolved object in session cache: [com.sonu.pojo.Employee#1]
2008-05-09 11:08:50,845 (Loader.java:709) DEBUG - done processing result set (1 rows)
2008-05-09 11:08:50,861 (AbstractBatcher.java:381) DEBUG - about to close ResultSet (open ResultSets: 1, globally: 1)
2008-05-09 11:08:50,861 (AbstractBatcher.java:366) DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2008-05-09 11:08:50,861 (AbstractBatcher.java:525) DEBUG - closing statement
2008-05-09 11:08:50,861 (ConnectionManager.java:398) DEBUG - aggressively releasing JDBC connection
2008-05-09 11:08:50,861 (ConnectionManager.java:435) DEBUG - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2008-05-09 11:08:50,861 (DriverManagerConnectionProvider.java:129) DEBUG - returning connection to pool, pool size: 1
2008-05-09 11:08:50,861 (Loader.java:839) DEBUG - total objects hydrated: 2
2008-05-09 11:08:50,861 (TwoPhaseLoad.java:107) DEBUG - resolving associations for [com.sonu.pojo.Employee#1]
2008-05-09 11:08:50,876 (DefaultLoadEventListener.java:169) DEBUG - loading entity: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,876 (DefaultLoadEventListener.java:212) DEBUG - entity proxy found in session cache
2008-05-09 11:08:50,876 (DefaultLoadEventListener.java:328) DEBUG - attempting to resolve: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,876 (DefaultLoadEventListener.java:341) DEBUG - resolved object in session cache: [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,876 (TwoPhaseLoad.java:206) DEBUG - done materializing entity [com.sonu.pojo.Employee#1]
2008-05-09 11:08:50,892 (TwoPhaseLoad.java:107) DEBUG - resolving associations for [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,892 (CollectionLoadContext.java:132) DEBUG - returning loading collection:[com.sonu.pojo.Organization.employees#1]
2008-05-09 11:08:50,892 (TwoPhaseLoad.java:206) DEBUG - done materializing entity [com.sonu.pojo.Organization#1]
2008-05-09 11:08:50,892 (CollectionLoadContext.java:262) DEBUG - 1 collections were found in result set for role: com.sonu.pojo.Organization.employees
2008-05-09 11:08:50,892 (CollectionLoadContext.java:206) DEBUG - collection fully initialized: [com.sonu.pojo.Organization.employees#1]
2008-05-09 11:08:50,908 (CollectionLoadContext.java:272) DEBUG - 1 collections initialized for role: com.sonu.pojo.Organization.employees
2008-05-09 11:08:50,908 (StatefulPersistenceContext.java:748) DEBUG - initializing non-lazy collections
2008-05-09 11:08:50,908 (Loader.java:1807) DEBUG - done entity load
2008-05-09 11:08:50,908 (Startup.java:25) DEBUG - The employees of the organization are[com.sonu.pojo.Employee@5e1077]
2008-05-09 11:08:50,908 (Startup.java:26) DEBUG - The number of employees of the organization are2
2008-05-09 11:08:50,908 (Startup.java:27) DEBUG - The actual number of employees of the organization are1


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html

_________________
Sachin


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 09, 2008 2:56 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Hi Sachin,
Your mapping file needs a small change.

Code:
<set name="employees" inverse="true" lazy="false" fetch="join" table="employee" cascade="all">
<key column="EMPLOYEE_ID"/>
<one-to-many class="Employee" />
</set>


should change to

Code:
<set name="employees" inverse="true" lazy="false" fetch="join" table="employee" cascade="all">
<key column="ORG_ID"/>
<one-to-many class="Employee" />
</set>


These means org_id is the column that links an employee and organization

And sachin, next time when you post your code, don't forget to use the "Code" function. It will make your post more readable ;)

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 09, 2008 4:02 am 
Newbie

Joined: Mon Mar 31, 2008 10:15 am
Posts: 5
Thanks Sukirtha this solution works for me.
I will remember the suggestion what you have given to me.
Thanks agian.

_________________
Sachin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.