Hibernate Version: Hibernate Tools 3.2.0.beta8
Code uses: Spring Framework.
Hi,
Our code is inserting 2 rows in the table. Our code is using hibernate to do so.
Here are our tables’ structures:
We have 3 tables: Organizations, Customers and AdPackages.
Organizations and Customers associated with Organization_Id.
Customers and AdPackages associated with Customer_Id.
adPackage = new AdPackages();
adPackage.setCancelled('N');
adPackage.setDbLock('N');
adPackage.setEdrDatasourceName("DAT");
adPackage.setDatasourceDesc("Data Admin Tool");
Customers cust = new Customers();
cust.setActive('Y');
cust.setCreateDate(new Date());
cust.setCreateDbUser(applicationData.getDB_USER_NAME());
cust.setOrganizations(org); // where org is Organizations instance
cust.getAdPackageses().add(adPackage);//where adPackage is AdPackage instance
adPackage.setCustomers(cust);
Now, we have question because above code working different way in 2 files.
In one file it is creating single row for AdPackages and in other file same code is creating 2 rows for AdPackages.
Do you have any idea about this problem?
Please let us know.
|