[Hibernate-JIRA] Created: (EJB-286) Hibernate does not honor @Column(name=...) annotation with IdClass
by Dusty (JIRA)
Hibernate does not honor @Column(name=...) annotation with IdClass
------------------------------------------------------------------
Key: EJB-286
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-286
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.1.GA
Environment: Netbeans 5.5, Java6
Reporter: Dusty
I'have an Entity which uses an IdClass, when I execute the simplest query Hibernate fails because it's using the name of the attribute instead of the one indicated by the @Column annotation.
The IdClass is defined as follows:
public class DomainAdminId implements Serializable {
private String domainName;
private String adminUser;
public DomainAdminId() {
}
public DomainAdminId(String domainName, String adminUser) {
this.domainName = domainName;
this.adminUser = adminUser;
}
public String getDomainName() {
return domainName;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public String getAdminUser() {
return adminUser;
}
public void setAdminUser(String adminUser) {
this.adminUser = adminUser;
}
public boolean equals(Object o) {
return ((o instanceof DomainAdminId) &&
domainName.equals(((DomainAdminId)o).getDomainName()) &&
adminUser.equals(((DomainAdminId)o).getAdminUser()));
}
public int hashCode() {
return (domainName+adminUser).hashCode();
}
}
And the following Entity using that idClass:
@Entity
@Table(name="domainadmin")
@IdClass(DomainAdminId.class)
@NamedQueries( {
@NamedQuery(name = "DomainAdmin.test", query = "SELECT d FROM DomainAdmin d")
)
public class DomainAdmin implements Serializable {
@Id
@Column(name="domain_name")
private String domainName;
@Id
@Column(name="adminuser")
private String adminUser;
public DomainAdmin() {
}
public String getDomainName() {
return domainName;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public String getAdminUser() {
return adminUser;
}
public void setAdminUser(String adminUser) {
this.adminUser = adminUser;
}
}
When executing the DomainAdmin.test Named Query I got this error:
could not execute query [select domainadmi0_.adminUser as adminUser1_, domainadmi0_.domainName as domainName1_ from domainadmin domainadmi0_]
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'domainadmi0_.domainName' in 'field list'
In effect, as indicated in the source, the column name is "domain_name" and not "domainName".
The same apply for the other column: adminUser (that should instead be "adminuser"),
This issue is blocking for me, do you have any workaround for the time being?
--
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-2994) Composite-key self reference causes invalid SQL on select query
by Kocha Kaden (JIRA)
Composite-key self reference causes invalid SQL on select query
---------------------------------------------------------------
Key: HHH-2994
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2994
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, SqlServer 2000
Reporter: Kocha Kaden
When creating a mapping on a composite-key table that maps back to itself, Hibernate gets confused and generates invalid SQL if I do a select statement checking for null.
HQL "from TestBean where superceededBy is null" results in:
"select testbean0_.id as id0_, testbean0_.createdDate as createdD2_0_, testbean0_.name as name0_, testbean0_.superceededById as supercee4_0_, testbean0_.superceededByCreatedDate as supercee5_0_ from TestBean testbean0_ where (testbean0_.superceededById, testbean0_.superceededByCreatedDate) is null"
SqlServer does not understand "where (testbean0_.superceededById, testbean0_.superceededByCreatedDate) is null".
It should be "where testbean0_.superceededById is null and testbean0_.superceededByCreatedDate is null"
Code follows:
TestBean.hbm.xml
<hibernate-mapping>
<class name="org.test.htest.TestBean" table="TestBean">
<composite-id>
<key-property name="id" type="integer" column="id" />
<key-property name="createdDate" type="java.util.Date" column="createdDate" />
</composite-id>
<property name="name" type="string" column="name" />
<many-to-one name="superceededBy" foreign-key="fk_TestBeanSuperceededBy_TestBeanIdCreatedDate">
<column name="superceededById"/>
<column name="superceededByCreatedDate"/>
</many-to-one>
</class>
</hibernate-mapping>
TestBean.java:
public class TestBean implements Serializable
{
private static final long serialVersionUID = 1L;
private int id;
private Date createdDate;
private String name;
private TestBean superceededBy;
public Date getCreatedDate()
{
return createdDate;
}
public void setCreatedDate(Date createdDate)
{
this.createdDate = createdDate;
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public TestBean getSuperceededBy()
{
return superceededBy;
}
public void setSuperceededBy(TestBean superceededBy)
{
this.superceededBy = superceededBy;
}
}
Main.java:
public class Main
{
public static void main(String[] args)
{
Configuration cfg = new Configuration();
cfg.configure("/hibernate.cfg.xml");
SessionFactory sessionFactory = cfg.buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
Transaction tx = null;
try
{
tx = session.beginTransaction();
Query query = session.createQuery("from TestBean where superceededBy is null");
List result = query.list();
tx.commit();
System.out.println("Got " + result.size() + " results");
System.out.flush();
}
catch(HibernateException e)
{
if (tx != null && tx.isActive())
{
tx.rollback();
}
}
sessionFactory.close();
}
}
--
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] Commented: (HHH-1523) LazyInitializationError on enabling query cache...
by Faizal Abdoelrahman (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1523?page=c... ]
Faizal Abdoelrahman commented on HHH-1523:
------------------------------------------
Hi Erik,
I saw that page and indeed resorted to traversing the rather complicated graph I have and putting hibernate.initialize everywhere. Way uncool!! Why don't they mark "left join fetch" deprecated then, as hibernate.initialize seems to be the official answer ?
What annoys me is that turning query cache on actually breaks the application whereas running without gives no problems. There are more errors down the road since I have passed this stage. ObjectNotNound exceptions when you delete an object that was in a collection cache. The official hibernate answer is to properly maintain your object graph (which makes sense) and delete the object yourself from your graph. However some objects I don't have access to since they are contained in totally different use-cases.
Anyway luckily I can resort to workarounds (like hibernate.initialize and evicting the collection cache manually for the other problems).
Hope they close this bug shortly, it's been lingering around for too long.
Regards,
Faizal Abdoelrahman
> LazyInitializationError on enabling query cache...
> --------------------------------------------------
>
> Key: HHH-1523
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1523
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5, 3.1
> Environment: 3.0.1 and 3.1, HSQLDB and Oracle
> Reporter: Vikas Sasidharan
> Attachments: cache_issue.log, QueryCacheIssue.zip
>
>
> I have two domain objects - Employee and Department - and there is a 1:N relationship from Department to Employee. When I join fetch an Employee with its Department, without query cache enabled, it works fine. If I enable query cache for this same query, it bombs with a LazyInitializationException.
> Notes:
> 1) We get this error only if query cache is enabled.
> 2) We observed the same behaviour on both oscache and ehcache
> 3) Calling Hibernate.initialize() explicitly after firing the HQL seems to work. The initialization does not fire an extra query though (it seems to pick it from the cache).
> 4) Setting "lazy=false" on the "many-to-one" mapping also works. However, it wouldn't be acceptable.
> Hibernate version: 3.0.5
> Mapping documents:
> Employee.hbm.xml
> <hibernate-mapping>
> <class name="tavant.platform.test.domain.Employee"
> table="CACHE_ISSUE_EMP" lazy="true" dynamic-update="true" dynamic-insert="true">
> <cache usage="read-write" />
> <id name="id" column="EMP_ID" type="java.lang.Long"
> access="field" unsaved-value="null">
> <generator class="increment" />
> </id>
>
> <property name="name" type="string" update="true"
> insert="true" column="EMP_NAME"/>
> <many-to-one name="department" class="tavant.platform.test.domain.Department"
> cascade="none" outer-join="auto" update="true" insert="true" column="DEPARTMENT_ID"/>
> </class>
> </hibernate-mapping>
>
> Department.hbm.xml
> <hibernate-mapping>
> <class name="tavant.platform.test.domain.Department" table="CACHE_ISSUE_DEP"
> lazy="true" dynamic-update="true" dynamic-insert="true">
>
> <cache usage="read-write" />
> <id name="id" column="DEPARTMENT_ID"
> type="java.lang.Long" access="field">
> <generator class="increment"/>
> </id>
> <property name="name" type="java.lang.String"
> update="false" insert="true" column="NAME"/>
> <bag name="employees" lazy="true"
> inverse="true" cascade="save-update" access="field">
> <cache usage="read-write"/>
> <key column="DEPARTMENT_ID"/>
> <one-to-many class="tavant.platform.test.domain.Employee"/>
> </bag>
> </class>
> </hibernate-mapping>
>
> Code between sessionFactory.openSession() and session.close():
> public Employee getEmployeeWithDepartment(String empName) {
> Session session = null;
> try {
> session = sessionFactory.openSession();
> Employee emp = (Employee) session.createQuery(
> "from Employee e join fetch e.department where e.name = :name")
> .setString("name", empName)
> .setCacheable(true)
> .uniqueResult();
> // If I uncomment the next line, this works (even without
> // firing an extra query)!
> // Hibernate.initialize(emp.getDepartment());
> return emp;
> } finally {
> if (session != null) {
> session.close();
> }
> }
> }
>
> // First load employee and populate cahces
> Employee emp = test.getEmployeeWithDepartment(EMPLOYEE_NAME);
> System.out.println("Employee : " + emp + ", Employee.Department : "
> + emp.getDepartment());
>
> // Now try to make use of the cache
> emp = test.getEmployeeWithDepartment(EMPLOYEE_NAME);
> System.out.println("Employee : " + emp + ", Employee.Department : "
> + emp.getDepartment());
>
> Full stack trace of any exception that occurs:
> org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
> at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
> at tavant.platform.test.domain.Department$$EnhancerByCGLIB$$67b26899.toString(<generated>)
> at java.lang.String.valueOf(String.java:2131)
> at java.lang.StringBuffer.append(StringBuffer.java:370)
> at tavant.platform.test.client.TestPrefetchRelationWithQueryCacheEnabled.main(TestPrefetchRelationWithQueryCacheEnabled.java:116)
>
> Name and version of the database you are using:
> We have noticed this on Oracle and HSQL
> The generated SQL (show_sql=true):
> #First read, goes fine
> Hibernate: select employee0_.EMP_ID as EMP1_0_, department1_.DEPARTMENT_ID as DEPARTMENT1_1_, employee0_.EMP_NAME as EMP2_1_0_, employee0_.DEPARTMENT_ID as DEPARTMENT3_1_0_, department1_.NAME as NAME0_1_ from CACHE_ISSUE_EMP employee0_ inner join CACHE_ISSUE_DEP department1_ on employee0_.DEPARTMENT_ID=department1_.DEPARTMENT_ID where (employee0_.EMP_NAME=? )
> #Prints the Employee and Department fine
> Employee : [Id : 1, name : testEmployee], Employee.Department : [Id : 1, name : testDepartment]
> #Second read bombs!
> org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
> at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
> [..]
> Please have a look at the post [http://forum.hibernate.org/viewtopic.php?t=955839] for more details and follow ups.
> Kindly help. I am attaching an Eclipse Project containing the TestCase. The main file is TestPrefetchRelationWithQueryCacheEnabled.
> Thanks,
> Vikas
--
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] Commented: (HHH-1523) LazyInitializationError on enabling query cache...
by Erik Innocent (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1523?page=c... ]
Erik Innocent commented on HHH-1523:
------------------------------------
I've encountered this exact problem and can verify a workaround. The problem is covered well here:
http://www.sourcelabs.com/?page=kb&task=art&cat=12&selectedid=70
To quote it, the problem is characterized as:
[quote]
Hibernate incorrectly throws LazyInitializationException when all the following conditions are satisfied:
1. a collection is mapped with lazy="true" or a single-valued association is mapped with lazy="proxy",
2. the lazy mapping is overriden when querying the parent using a Criteria with fetch mode set to FetchMode.JOIN (or the deprecated FetchMode.EAGER) or using HQL with "left join fetch",
3. the query cache is enabled and the query results are up-to-date,
4. the collection/association is accessed outside the Hibernate Session in which the Criteria or HQL was executed.
[/quote]
The solution, which I also found at that link, is to make use of Hibernate.initialize(Object o) on each eagerly fetched association before the main object gets detached. Examples can be found at the link, though I was able to get by without resorting to those ugly transaction calls and their try-catches.
For the record, this is uncool and caused me to waste a few days, but I'm glad at least there's a straightforward and cheap workaround. Also, being happy to have it working at all, I haven't checked to see if the Hibernate.initialize(Object o) is in fact hitting the cache, or if it's calling through to the DB. I leave this as an exercise for the reader.
> LazyInitializationError on enabling query cache...
> --------------------------------------------------
>
> Key: HHH-1523
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1523
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5, 3.1
> Environment: 3.0.1 and 3.1, HSQLDB and Oracle
> Reporter: Vikas Sasidharan
> Attachments: cache_issue.log, QueryCacheIssue.zip
>
>
> I have two domain objects - Employee and Department - and there is a 1:N relationship from Department to Employee. When I join fetch an Employee with its Department, without query cache enabled, it works fine. If I enable query cache for this same query, it bombs with a LazyInitializationException.
> Notes:
> 1) We get this error only if query cache is enabled.
> 2) We observed the same behaviour on both oscache and ehcache
> 3) Calling Hibernate.initialize() explicitly after firing the HQL seems to work. The initialization does not fire an extra query though (it seems to pick it from the cache).
> 4) Setting "lazy=false" on the "many-to-one" mapping also works. However, it wouldn't be acceptable.
> Hibernate version: 3.0.5
> Mapping documents:
> Employee.hbm.xml
> <hibernate-mapping>
> <class name="tavant.platform.test.domain.Employee"
> table="CACHE_ISSUE_EMP" lazy="true" dynamic-update="true" dynamic-insert="true">
> <cache usage="read-write" />
> <id name="id" column="EMP_ID" type="java.lang.Long"
> access="field" unsaved-value="null">
> <generator class="increment" />
> </id>
>
> <property name="name" type="string" update="true"
> insert="true" column="EMP_NAME"/>
> <many-to-one name="department" class="tavant.platform.test.domain.Department"
> cascade="none" outer-join="auto" update="true" insert="true" column="DEPARTMENT_ID"/>
> </class>
> </hibernate-mapping>
>
> Department.hbm.xml
> <hibernate-mapping>
> <class name="tavant.platform.test.domain.Department" table="CACHE_ISSUE_DEP"
> lazy="true" dynamic-update="true" dynamic-insert="true">
>
> <cache usage="read-write" />
> <id name="id" column="DEPARTMENT_ID"
> type="java.lang.Long" access="field">
> <generator class="increment"/>
> </id>
> <property name="name" type="java.lang.String"
> update="false" insert="true" column="NAME"/>
> <bag name="employees" lazy="true"
> inverse="true" cascade="save-update" access="field">
> <cache usage="read-write"/>
> <key column="DEPARTMENT_ID"/>
> <one-to-many class="tavant.platform.test.domain.Employee"/>
> </bag>
> </class>
> </hibernate-mapping>
>
> Code between sessionFactory.openSession() and session.close():
> public Employee getEmployeeWithDepartment(String empName) {
> Session session = null;
> try {
> session = sessionFactory.openSession();
> Employee emp = (Employee) session.createQuery(
> "from Employee e join fetch e.department where e.name = :name")
> .setString("name", empName)
> .setCacheable(true)
> .uniqueResult();
> // If I uncomment the next line, this works (even without
> // firing an extra query)!
> // Hibernate.initialize(emp.getDepartment());
> return emp;
> } finally {
> if (session != null) {
> session.close();
> }
> }
> }
>
> // First load employee and populate cahces
> Employee emp = test.getEmployeeWithDepartment(EMPLOYEE_NAME);
> System.out.println("Employee : " + emp + ", Employee.Department : "
> + emp.getDepartment());
>
> // Now try to make use of the cache
> emp = test.getEmployeeWithDepartment(EMPLOYEE_NAME);
> System.out.println("Employee : " + emp + ", Employee.Department : "
> + emp.getDepartment());
>
> Full stack trace of any exception that occurs:
> org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
> at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
> at tavant.platform.test.domain.Department$$EnhancerByCGLIB$$67b26899.toString(<generated>)
> at java.lang.String.valueOf(String.java:2131)
> at java.lang.StringBuffer.append(StringBuffer.java:370)
> at tavant.platform.test.client.TestPrefetchRelationWithQueryCacheEnabled.main(TestPrefetchRelationWithQueryCacheEnabled.java:116)
>
> Name and version of the database you are using:
> We have noticed this on Oracle and HSQL
> The generated SQL (show_sql=true):
> #First read, goes fine
> Hibernate: select employee0_.EMP_ID as EMP1_0_, department1_.DEPARTMENT_ID as DEPARTMENT1_1_, employee0_.EMP_NAME as EMP2_1_0_, employee0_.DEPARTMENT_ID as DEPARTMENT3_1_0_, department1_.NAME as NAME0_1_ from CACHE_ISSUE_EMP employee0_ inner join CACHE_ISSUE_DEP department1_ on employee0_.DEPARTMENT_ID=department1_.DEPARTMENT_ID where (employee0_.EMP_NAME=? )
> #Prints the Employee and Department fine
> Employee : [Id : 1, name : testEmployee], Employee.Department : [Id : 1, name : testDepartment]
> #Second read bombs!
> org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
> at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
> [..]
> Please have a look at the post [http://forum.hibernate.org/viewtopic.php?t=955839] for more details and follow ups.
> Kindly help. I am attaching an Eclipse Project containing the TestCase. The main file is TestPrefetchRelationWithQueryCacheEnabled.
> Thanks,
> Vikas
--
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] Commented: (HHH-1820) Lazy loading problem when property-ref is used for collections
by srs (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1820?page=c... ]
srs commented on HHH-1820:
--------------------------
I can confirm that we get the same LazyInitializationException on many-to-many relations with propery-ref's when using lazy loading on MySQL 5.x and Hibernate 3.1.2.
> Lazy loading problem when property-ref is used for collections
> --------------------------------------------------------------
>
> Key: HHH-1820
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1820
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.3
> Environment: Oracle 8.1.7
> Reporter: Jakub Mendys
>
> Consider mapping
> <class name="MedDRATerm" table="MBROW_MEDDRA_TERMS" mutable="false"
> batch-size="50">
> <cache usage="read-only" region="dictionary" />
> <id name="medDRATermId" type="long" column="TERM_ID">
> <generator class="assigned" />
> </id>
> <map name="termNames" table="MBROW_TERM_NAMES" lazy="true"
> batch-size="50">
> <cache usage="read-only" region="dictionary" />
> <key column="MEDDRA_CODE" property-ref="medDRACode" />
> <index column="LANGUAGE_ID"
> type="com.roche.dss.meddra.dao.type.LanguageType" />
> <element column="NAME" type="string" />
> </map>
> <property name="medDRACode" column="MEDDRA_CODE"
> type="com.roche.dss.meddra.dao.type.MedDRACodeType" />
> </class>
> <class name="MedDRATermInstance" table="MBROW_MEDDRA_TREES"
> mutable="false">
> <cache usage="read-only" region="dictionary" />
> <id name="medDRATermInstanceId" type="long" column="NODE_ID">
> <generator class="assigned" />
> </id>
> <many-to-one name="medDRATerm" class="MedDRATerm"
> column="TERM_ID" fetch="join" not-null="true" insert="false"
> update="false" />
> </class>
> When you execute a query:
> from MedDRATermInstance i where i.version=:versionId and i.medDRATerm in (:terms)
> and then using the _same session_ you will iterate over returned collection and will call session.get(id) for returned records it is very likely that for _SOME_ (random??) of objects when you will try to access its properties you will get following exception thrown:
> 2006-06-07 19:25:11,942 ERROR org.hibernate.LazyInitializationException - failed to lazily initialize a collection of role: com.roche.dss.meddra.model.MedDRATerm.termNames, no session or session was
> losed
> org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.roche.dss.meddra.model.MedDRATerm.termNames, no session or session was closed
> at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> at org.hibernate.collection.AbstractPersistentCollection.readElementByIndex(AbstractPersistentCollection.java:151)
> at org.hibernate.collection.PersistentMap.get(PersistentMap.java:127)
> Calling session.clear() before session.get() helps to workaround this but causes all the records to be fethed again from the database.
--
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-2985) Patch to HHH-952 should propagate enabledFilters
by Céline Launay (JIRA)
Patch to HHH-952 should propagate enabledFilters
------------------------------------------------
Key: HHH-2985
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2985
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Reporter: Céline Launay
The patch submitted for issue HHH-952 reads like so :
// patch to generate joins on subqueries stolen from CriteriaLoader
CriteriaJoinWalker walker = new CriteriaJoinWalker(persister,
innerQuery, factory, criteriaImpl, criteriaImpl
.getEntityOrClassName(), new HashMap()) {
// need to override default of "this_" to whatever the innerQuery is using
protected String generateRootAlias(final String description) {
return innerQuery.getRootSQLALias();
}
};
Note how it passes a new HashMap as filters. Wouldn't it be better to propagate session.getEnabledFilters(), like so :
// patch to generate joins on subqueries stolen from CriteriaLoader
CriteriaJoinWalker walker = new CriteriaJoinWalker(persister,
innerQuery, factory, criteriaImpl, criteriaImpl
.getEntityOrClassName(), session.getEnabledFilters()) {
// need to override default of "this_" to whatever the innerQuery is using
protected String generateRootAlias(final String description) {
return innerQuery.getRootSQLALias();
}
};
--
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