[Hibernate-JIRA] Commented: (HHH-817) Projection aliases should not be applied to where-clause (Milosz Tylenda)
by Michal Jastak (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-817?page=co... ]
Michal Jastak commented on HHH-817:
-----------------------------------
Is there anyone who tracks the longest open issue for hibernate? does this issue win with its 5 years 27 days since the reporting?
I'm really sorry that it took so much time to fix it, sorry in behalf of all developers who have to use some tricks and workarounds for all those years.
Sorry in behalf of Milosz, who has provided patch for this issue more than 3 years ago (!) ...
... and I'm extremely thankful to Gail, who was the one and only brave enough to solve it finally :)
Gail, thanks!
> Projection aliases should not be applied to where-clause (Milosz Tylenda)
> -------------------------------------------------------------------------
>
> Key: HHH-817
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-817
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5, 3.5.5, 3.6.0.Beta3
> Environment: Oracle 9.2.0.6, Hibernate 3.0.5, Spring Framework 1.2.2 based application working on Jakarta Tomcat 5.0.28
> Reporter: Michal Jastak
> Assignee: Gail Badner
> Fix For: 3.6.0.Beta4
>
> Attachments: HHH-817.patch, HHH-817_3.3.2GA_17882.patch
>
>
> following java code:
> protected Entity loadEntityLightweight(Serializable entityId) throws DataAccessException {
> Criteria criteria = getSession().createCriteria(Entity.class);
> ProjectionList projectionList = Projections.projectionList();
> projectionList.add(Property.forName(BaseEntity.PROP_ID), BaseEntity.PROP_ID);
> projectionList.add(Property.forName(BaseEntity.PROP_TYPE), BaseEntity.PROP_TYPE);
> criteria.setProjection(projectionList);
> criteria.add(Restrictions.eq(BaseEntity.PROP_ID, entityId));
> criteria.setResultTransformer(new AliasToBeanResultTransformer(Entity.class));
> return (Entity) criteria.uniqueResult();
> }
> generates following SQL query:
> select this_.id as y0_, this_.type as y1_ from entities this_ left outer join facilities this_1_ on this_.id=this_1_.id left outer join users this_2_ on this_.id=this_2_.id left outer join addresses address2_ on this_.address_id=address2_.id left outer join entities entity3_ on this_2_.employer_id=entity3_.id left outer join facilities entity3_1_ on entity3_.id=entity3_1_.id left outer join users entity3_2_ on entity3_.id=entity3_2_.id where y0_=?
> y0_ = ? expression in where clause is causing a 904 error on Oracle 9:
> ORA-00904: "Y0_": invalid identifier
> hibernate dialect: org.hibernate.dialect.Oracle9Dialect
> mapping for Entity class:
> <?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 default-lazy="false" default-cascade="save-update">
>
> <class name="Entity" table="entities" mutable="true">
> <id name="id" type="java.lang.Long" unsaved-value="null">
> <generator class="sequence">
> <param name="sequence">entities_id_seq</param>
> </generator>
> </id>
> <many-to-one name="address" class="Address" column="address_id" />
> ...
> <!--
> - Facilities
> -->
> <joined-subclass name="Facility" table="facilities">
> <key column="id" />
> ...
> <set name="users" inverse="true" lazy="true">
> <key column="facility_id" />
> <one-to-many class="User" />
> </set>
> </joined-subclass>
> <!--
> - Users
> -->
> <joined-subclass name="User" table="users" dynamic-insert="true" dynamic-update="true">
> <key column="id" />
> <many-to-one name="employer" class="Entity" column="employer_id" cascade="none" />
> ...
> <set name="userAuthorities" inverse="true" cascade="all-delete-orphan">
> <key column="user_id" />
> <one-to-many class="Authority" />
> </set>
> </joined-subclass>
> </class>
> </hibernate-mapping>
--
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
15 years, 7 months
[Hibernate-JIRA] Created: (HHH-5519) VersionedItem should not extend Item, otherwise query cache are confusing
by Galder Zamarreno (JIRA)
VersionedItem should not extend Item, otherwise query cache are confusing
-------------------------------------------------------------------------
Key: HHH-5519
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5519
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.6.0.Beta3, 3.5.5
Reporter: Galder Zamarreno
Assignee: Galder Zamarreno
Fix For: 3.6.0.Beta4, 3.5.6
Fix org.hibernate.test.cache.infinispan.functional.BasicTransactionalTestCase.testQueryCache failure:
The difference in behavior recently is the following: Hibernate has always treated VersionedItem and Item as two query translators for queries like "from Item". The difference is that in the past, the 2nd time a query was executed, VersionedItem query resulted on a query put whereas now it's a query hit. This leads to query hits being 2 instead of 1. 2 is probably correct if you consider VersionedItem to be an Item, which it is. In the past, VersionedItem query would have been considered a put, even the second time around and so query hit was only 1.
If you want to investigate further, simply have two entities, one extending each other and do 2 queries with "from X" where X is the top class. In 3.5.0, the first query resulted in two query puts and the second one resulted in 1 query put, 1 query hit. In trunk and 3.5.x now, the first query results in two query puts and the 2nd query in two query hits.
For my tests, I'm getting rid of this polymorphism to avoid testing stuff I don't need to be testing from an Infinispan perspective.
--
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
15 years, 7 months
[Hibernate-JIRA] Created: (HHH-5516) net.sf.hibernate.type.StringType contains wrong SQL generation
by Joachim Durchholz (JIRA)
net.sf.hibernate.type.StringType contains wrong SQL generation
--------------------------------------------------------------
Key: HHH-5516
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5516
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.5
Environment: (Actually Hibernate 3.5.4)
Reporter: Joachim Durchholz
Priority: Critical
objectToSQLString does not fulfill the contract on org.hibernate.type.LiteralType.objectToSQLString for strings that contain single quotes.
I know that Oracle requires that quotes be doubled (and I believe that it follows the SQL standard in doing so), so
{{'\'' + (String) value + '\''}}
should be replaced with
{{'\'' + ((String) value).replace ("'", "''") + '\''}}
The issue was already considered in HB-192, but the discussion there was limited to security concerns and missed the contractual problem.
(I noticed the problem while searching for a way to do the reverse of objectToSQLString, namely parse an SQL constant expression into a LiteralType value. That's why I don't know how to construct a test case, sorry.)
--
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
15 years, 7 months
[Hibernate-JIRA] Commented: (HHH-817) Projection aliases should not be applied to where-clause (Milosz Tylenda)
by Mark A. Ziesemer (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-817?page=co... ]
Mark A. Ziesemer commented on HHH-817:
--------------------------------------
Thank you as well!
Is there any chance this could be fixed for 3.5.x, maybe 3.5.6? Otherwise, is there a scheduled date for a final 3.6.0 release?
> Projection aliases should not be applied to where-clause (Milosz Tylenda)
> -------------------------------------------------------------------------
>
> Key: HHH-817
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-817
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5, 3.5.5, 3.6.0.Beta3
> Environment: Oracle 9.2.0.6, Hibernate 3.0.5, Spring Framework 1.2.2 based application working on Jakarta Tomcat 5.0.28
> Reporter: Michal Jastak
> Assignee: Gail Badner
> Fix For: 3.6.0.Beta4
>
> Attachments: HHH-817.patch, HHH-817_3.3.2GA_17882.patch
>
>
> following java code:
> protected Entity loadEntityLightweight(Serializable entityId) throws DataAccessException {
> Criteria criteria = getSession().createCriteria(Entity.class);
> ProjectionList projectionList = Projections.projectionList();
> projectionList.add(Property.forName(BaseEntity.PROP_ID), BaseEntity.PROP_ID);
> projectionList.add(Property.forName(BaseEntity.PROP_TYPE), BaseEntity.PROP_TYPE);
> criteria.setProjection(projectionList);
> criteria.add(Restrictions.eq(BaseEntity.PROP_ID, entityId));
> criteria.setResultTransformer(new AliasToBeanResultTransformer(Entity.class));
> return (Entity) criteria.uniqueResult();
> }
> generates following SQL query:
> select this_.id as y0_, this_.type as y1_ from entities this_ left outer join facilities this_1_ on this_.id=this_1_.id left outer join users this_2_ on this_.id=this_2_.id left outer join addresses address2_ on this_.address_id=address2_.id left outer join entities entity3_ on this_2_.employer_id=entity3_.id left outer join facilities entity3_1_ on entity3_.id=entity3_1_.id left outer join users entity3_2_ on entity3_.id=entity3_2_.id where y0_=?
> y0_ = ? expression in where clause is causing a 904 error on Oracle 9:
> ORA-00904: "Y0_": invalid identifier
> hibernate dialect: org.hibernate.dialect.Oracle9Dialect
> mapping for Entity class:
> <?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 default-lazy="false" default-cascade="save-update">
>
> <class name="Entity" table="entities" mutable="true">
> <id name="id" type="java.lang.Long" unsaved-value="null">
> <generator class="sequence">
> <param name="sequence">entities_id_seq</param>
> </generator>
> </id>
> <many-to-one name="address" class="Address" column="address_id" />
> ...
> <!--
> - Facilities
> -->
> <joined-subclass name="Facility" table="facilities">
> <key column="id" />
> ...
> <set name="users" inverse="true" lazy="true">
> <key column="facility_id" />
> <one-to-many class="User" />
> </set>
> </joined-subclass>
> <!--
> - Users
> -->
> <joined-subclass name="User" table="users" dynamic-insert="true" dynamic-update="true">
> <key column="id" />
> <many-to-one name="employer" class="Entity" column="employer_id" cascade="none" />
> ...
> <set name="userAuthorities" inverse="true" cascade="all-delete-orphan">
> <key column="user_id" />
> <one-to-many class="Authority" />
> </set>
> </joined-subclass>
> </class>
> </hibernate-mapping>
--
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
15 years, 7 months