[Hibernate-JIRA] Created: (HHH-2829) SubqueryExpression create wrong sql in the case DetachedCriteria has Subcriteria
by Sunao Suzuki (JIRA)
SubqueryExpression create wrong sql in the case DetachedCriteria has Subcriteria
--------------------------------------------------------------------------------
Key: HHH-2829
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2829
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5ga
Reporter: Sunao Suzuki
Priority: Critical
SubqueryExpression create wrong sql in the case DetachedCriteria has Subcriteria(inner join).
in the case using DetachedCriteria( has Subcriteria) like below , it's works good.
DetachedCriteria dc = DetachedCriteria.forClass(Person.class);
DetachedCriteria in = dc.createCriteria("emails");
in.add(Restrictions.eq("personEmailId", (long)1));
dc.setProjection(Projections.id());
Criteria c = dc.getExecutableCriteria(session);
c.list();
select this_.PERSON_ID as y0_ from PERSON this_ inner join PERSON_EMAIL personemai1_ on this_.PERSON_ID=personemai1_.FK_PERSON_ID where personemai1_.PERSON_EMAIL_ID=?
But in the case using DetachedCriteria( has Subcriteria) for subquery like below, it doesn't work.
DetachedCriteria dc = DetachedCriteria.forClass(Person.class);
DetachedCriteria in = dc.createCriteria("emails");
in.add(Restrictions.eq("personEmailId", (long)1));
dc.setProjection(Projections.id());
Criteria c = session.createCriteria(Person.class);
c.add(Subqueries.propertyIn("personId", dc));
c.setProjection(Projections.id());
c.list();
select this_.PERSON_ID as y0_ from PERSON this_ where this_.PERSON_ID in (select this0__.PERSON_ID as y0_ from PERSON this0__ where personemai1_.PERSON_EMAIL_ID=?)
I hope fix quickly.
--
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
17 years, 1 month
[Hibernate-JIRA] Created: (HHH-2837) Collections not getting loaded when an entity has a string primary key. This is observed only for Sql Server 2005. Works fine with My-Sql.
by zoharat bhiwandiwala (JIRA)
Collections not getting loaded when an entity has a string primary key. This is observed only for Sql Server 2005. Works fine with My-Sql.
------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2837
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2837
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5 . Microsoft Sql Server 2005. Data direct database driver for Sql Server 2005
Reporter: zoharat bhiwandiwala
Attachments: MySql.txt, SqlServer2005.txt
We have an entity called Batch, which holds a collection of BatchMember entities in it.
Batch has a primary key of type string.
When we load the Batch entity from Microsoft Sql server 2005, only the batch entity data is returned. The batch members collection is always empty. Which is incorrect as there are batch members associated with it.
This test works fine when we load the batch from My Sql server.
When I changed the Batch entities primary key to a long the batch members were retrieved from both the databases.
The test's produce the same result for FetchType.EAGER or FetchType.LAZY.
Attached are the hibernate sql which get generated.
Kindly observe the one for Sql Server 2005 with primary key as string . It runs 3 queries, the third one gets rid of the batchmembers . That does not happen when the primary key is of type integer.
--
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
17 years, 1 month