[Hibernate-JIRA] Created: (HHH-5571) Hibernate loading the wrong bean in collection from the session cache (very unusual case), it occurs only for specific set of data.
by vinay kumar (JIRA)
Hibernate loading the wrong bean in collection from the session cache (very unusual case), it occurs only for specific set of data.
-----------------------------------------------------------------------------------------------------------------------------------
Key: HHH-5571
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5571
Project: Hibernate Core
Issue Type: Bug
Environment: Ehcache(ehcache-core-2.0.0.jar), Jdk 1.6.0_12
Reporter: vinay kumar
Attachments: HibernateBug sources.rar
I have a customer order from a retail catalog project. The central class is the Order. Associated with it are the Customer and Provider Company, customer making the purchase and the Payment. A Payment is one of three kinds: Cash, Check, or Credit. The order contains OrderDetails (line items), each with its associated Item.
so each customer has set of orders in turn each order has one of the three kinds of payment. When ever i load two customers in the same transaction and i read the orders of the customers, one of the order is misplaced into other customer (it very unusual and happens only for specific set of data).
Test Case : I have two customers US customer and Italy Customer with set of orders. when i try to load the two customers in the same transaction and check the orders so i get the following values. Here i don't change any values, the session is readOnly. Bean hashcode and equals methods are manually overridden.
Italy Customer.getOrders
{start t1}
1) Order : [Customer Name = Italy Customer, Company Product : Apple Power Chord] Payment : Cheque = 100 €
2) Order : [Customer Name = Italy Customer, Company Product : Apple Mac Pro] Payment : Cheque = 2000 €
3) Order : [Customer Name = Italy Customer, Company Product : Microsoft Usb] Payment : Cheque = 200 €
4) Order : [Customer Name = Italy Customer, Company Product : Apple Mac Air] Payment : Cheque = 1500 €
5) Order : [Customer Name = Italy Customer, Company Product : Microsoft Keyboard] Payment : Credit = 73.7153€
6) Order : [Customer Name = Italy Customer, Company Product : Apple MacBook ] Payment : Cheque = 1000 €
7) Order : [Customer Name = Italy Customer, Company Product : Dell Mouse] Payment : Credit = 6.90361€
8) Order : [Customer Name = Italy Customer, Company Product : Apple TV] Payment : Cash = 10000€
9) Order : [Customer Name = Italy Customer, Company Product : Siemens HeadPhone] Payment : Credit = 100.0€
{end t1}
US Customer.getOrders
{start t2}
1) Order : [Customer Name = U.S Customer, Company Product : Dell Mouse] Payment : Credit = 6.69889$
2) Order : [Customer Name = U.S Customer, Company Product : Microsoft Keyboard] Payment : Credit = 73.7144$
3) Order : [Customer Name = U.S Customer, Company Product : Siemens HeadPhone] Payment : Credit = 164.0$
4) Order : [Customer Name = U.S Customer, Company Product : Apple TV] Payment : Cash = 10000$
5) Order : [Customer Name = U.S Customer, Company Product : Microsoft Usb] Payment : Cheque = 200 $
6) Order : [Customer Name = U.S Customer, Company Product : Apple MacBook ] Payment : Cheque = 1000 $
7) Order : [Customer Name = U.S Customer, Company Product : Apple Power Chord] Payment : Cheque = 100 $
8) Order : [Customer Name = U.S Customer, Company Product : Apple Mac Pro] Payment : Cheque = 2000 $
9) Order : [Customer Name = U.S Customer, Company Product : Apple Mac Air] Payment : Cheque = 1500 $
Italy Customer.getOrders
1) Order : [Customer Name = Italy Customer, Company Product : Apple Power Chord] Payment : Cheque = 100 €
2) Order : [Customer Name = Italy Customer, Company Product : Apple Mac Pro] Payment : Cheque = 2000 €
3) Order : [Customer Name = Italy Customer, Company Product : Microsoft Usb] Payment : Cheque = 200 €
4) Order : [Customer Name = Italy Customer, Company Product : Apple Mac Air] Payment : Cheque = 1500 €
5) Order : [Customer Name = Italy Customer, Company Product : Microsoft Keyboard] Payment : Credit = 73.7153€
6) Order : [Customer Name = Italy Customer, Company Product : Apple MacBook ] Payment : Cheque = 1000 €
7) Order : [Customer Name = U.S Customer, Company Product : Apple TV] Payment : Cash = 10000$
8) Order : [Customer Name = Italy Customer, Company Product : Apple TV] Payment : Cash = 10000€
9) Order : [Customer Name = Italy Customer, Company Product : Siemens HeadPhone] Payment : Credit = 100.0€
{ end t2}
where t1,2 are two different transactions. When im trying to load the italy customer in t2 the order 'Dell mouse' is replaced by US customer's 'Apple TV'.
Observations :
1) if i try to separate the transactions for each customer, the problem doesn't exist.
2) if i try to evict the same bean and try to load again , still the problem persists.(italy customer here)
3) if i try to evict the other bean and try to load, the problem doesnt exist.(US customer here)
4) if i try to clear the session and load again the orders all the time, the problem doesnt exist.
5) if i try to set the CacheMode to IGNORE still the problem persists.
6) This problem only exists for certain data values. In test case i have Italy Customer(cust_id = 5799847) and US Customer (cust_id = 5799736). If i change one of the id of the customer the problem doesnt exist. if i increase and decrease the both values by 'n' the problem persist again.(very strange).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5570) org.hibernate.AnnotationException: SecondaryTable JoinColumn cannot reference a non primary key
by Steve Schols (JIRA)
org.hibernate.AnnotationException: SecondaryTable JoinColumn cannot reference a non primary key
-----------------------------------------------------------------------------------------------
Key: HHH-5570
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5570
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.5.6
Environment: Hibernate-3.5.6-Final, HSQLDB
Reporter: Steve Schols
Attachments: Person.hbm.xml, Person.java
We have to couple to tables on different legacy databases.
One table is the Person table which has PERSON_ID as it's primary key. The other table is the Farmer table which has FARMER_NUMBER as it's primary key.
We are unable to map this specific situation in HBM XML mapping files. Whatever we configure, the generated SQL query will still join PERSON_ID = FARMER_NUMBER which always gives 0 results. The PERSON_ID is just a technical identifier, where the FARMER_NUMBER is a meaningfull business key.
I made a small Proof of Concept (PoC) about Person entities and PersonIdentification entities (Social Security Number, Date of Birth, Gender, ...) using HBM XML files and another PoC using JPA/Hibernate Annotations.
In the HBM XML PoC, the test went green but only because we generated the data ourselved and because PERSON_ID and SOCIAL_SECURITY_NUMBER were generated the same by Hibernate. The query did join PERSON_ID on SOCIAL_SECURITY_NUMBER.
In the Annotations PoC the test went red with the Exception mentioned in the summary: org.hibernate.AnnotationException: SecondaryTable JoinColumn cannot reference a non primary key
In this case, that's exactly what we want to accomplish on the legacy database. Join the primary key of a secondary table (SOCIAL_SECURITY_NUMBER in PERSON_IDENTIFICATION_TABLE) with a foreign key column (non-primary key) of a primary table (SOCIAL_SECURITY_NUMBER in PERSON_TABLE).
We can work around this issue by making a separate class for the extra information and mapping it as a OneToMany or OneToOne instead of holding the data in one class.
But we find the extra class a little bit redundant because it really contains PersonData.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1829) Allow join on any property using property-ref
by Steve Schols (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c... ]
Steve Schols commented on HHH-1829:
-----------------------------------
We're having the exact same problem. We also have to map to a legacy database which cannot be refactored. It is a central database used by all project teams and managed by a different team than ours.
Can anyone provide a solution to this bug?
> Allow join on any property using property-ref
> ---------------------------------------------
>
> Key: HHH-1829
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829
> Project: Hibernate Core
> Issue Type: New Feature
> Components: metamodel
> Affects Versions: 3.2.0 cr1, 3.2.0.cr2
> Reporter: Maarten Winkels
> Assignee: Anthony Patricio
> Attachments: AbstractJoinTest.java, HHH-1829-3.2.8-SNAPSHOT.patch, HHH-1829-mwinkels.patch, hhh-1829.patch, JoinNoPropertyRefTest.java, JoinPropertyRefTest.java, Person.hbm.xml, Person.java, PersonNoPropertyRef.hbm.xml
>
>
> Currently joining tables for one class (uing the <join...> tag) is only supported for the id property. The property-ref is allowed on the <key..> tag inside the <join..> tag, but this is ignored.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5567) To avoid default primary key coming in the order by list
by Satheeskumar (JIRA)
To avoid default primary key coming in the order by list
--------------------------------------------------------
Key: HHH-5567
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5567
Project: Hibernate Core
Issue Type: Task
Components: annotations
Reporter: Satheeskumar
I am using hibernate to generate run time query using createQuery method by mapping my all classes into DB tables. But in the generated query primary key field is coming at first in order by list. I dont want to order by primary key. Instead i want to order by another seqNo field at first. Can anybody advice me how to remove the default primary key ordering in the resulting query.
Ex: Select A1.a,B1.b,C1.c from A A1,B B1,C C1 order by B1.b
Here A1.a is the primary key. this key filed is coming in the resulting query like
"Select A1.a,B1.b,C1.c from A A1,B B1,C C1 order by A1.a,B1.b" But I dont want to sort by A1.1 and want to sort by B1.b
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-2426) Misleading logging messages when using ThreadLocalSessionContext
by Don Smith (JIRA)
Misleading logging messages when using ThreadLocalSessionContext
----------------------------------------------------------------
Key: HHH-2426
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2426
Project: Hibernate3
Type: Improvement
Components: core
Versions: 3.2.0.ga
Reporter: Don Smith
Priority: Minor
The log messages printed out by TransactionFactoryFactory and SettingsFactory are misleading when using ThreadLocalSessionContext:
2007-02-09 21:49:58,581 INFO [org.hibernate.transaction.TransactionFactoryFactory:info] Using default transaction strategy (direct JDBC transactions)
2007-02-09 21:49:58,588 INFO [org.hibernate.transaction.TransactionManagerLookupFactory:info] No TransactionManagerLookup Configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2007-02-09 21:49:58,590 INFO [org.hibernate.cfg.SettingsFactory:info] Automatic flush during beforeCompletion(): disabled
2007-02-09 21:49:58,591 INFO [org.hibernate.cfg.SettingsFactory:info] Automatic session close at end of transaction: disabled
This does not indicate that sessions will be closed after commit, which is the behavior when using ThreadLocalSessionContext.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
13 years, 7 months