[Hibernate-JIRA] Created: (HHH-4543) Hibernate does not allow a many-to-one to property-ref a composite unique key (properties element) that is based on many-to-one associations
by Chris Wilson (JIRA)
Hibernate does not allow a many-to-one to property-ref a composite unique key (properties element) that is based on many-to-one associations
--------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-4543
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4543
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.3.2
Environment: Ubuntu 8.04, mysql 5.0.51a-3ubuntu5.4, Connector/J, InnoDB tables
Reporter: Chris Wilson
Attachments: hibernate-testcase-unique-key-on-association.zip
The attached test case demonstrates the problem. Our situation is:
We have four tables in this minimal test case: projects, sites, project_sites and site_cost. project_sites is linked to both projects and sites by a unique key spanning both, defined as a <properties> element in the Hibernate mapping. The <property> elements inside this <properties> name many-to-one associations, not stand-alone <property> elements. See below for justification.
site_cost references this unique key using a project and a site as well, so it does not reference the primary key of project_sites, as that would duplicate data (site_id) and allow conflicts in our real-world code, where the site_id column is used in many other associations as well. Please bear with us on this database structure, as it's used for sharding and replicating tables between offline nodes based on site_ids.
We generate our schema from the Hibernate mappings to allow database portability, using Hibernate's SchemaExport.
The generation fails when adding the constraint to site_cost, because it incorrectly tries to use the database field names "site" and "project" (which don't exist, but are the names of the associations) in building the constraint, instead of "site_id" and "project_id" which do exist. The failing statement is:
alter table site_cost add index FKE02EFDC52F2411E6 (project_id, site_id), add constraint FKE02EFDC52F2411E6 foreign key (project_id, site_id) references project_site (project, site)
Which results in the error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: BLOB/TEXT column 'project' used in key specification without a key length
[...]
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:383)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:341)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:262)
at org.aptivate.hibernate.test.ReferencePropertiesTest.testReferenceToProperties(ReferencePropertiesTest.java:63)
[...]
One way to work around this is to change the <properties> in ProjectSite.hbm.xml to reference individual properties instead of many-to-one relationships, and add those properties to the mapping and the POJO class. However, I don't wish to add a useless and dangerous API (to directly set to my POJOs.
It should be possible to use the many-to-one mapping by extracting the column name(s) from it, and adding them to the unique index, but I guess Hibernate does not support that at present.
The documentation is not clear on whether it should support it or not. Perhaps it's implied that a properties > property.name should name an actual property and not a many-to-one association, but it appears sparsely documented to me, and this would definitely be a useful feature for us.
I'm sorry for not (yet) providing a patch myself, but I'm pretty new to Hibernate and not familiar with the code, and I currently can't build it due to the number of dependencies (and not being good with Maven).
--
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: (HBX-1133) java.lang.StackOverflowError when I try to use hibernate-tools-3.2.0.beta9a.jar with slf4j jars
by Ashish Zokarkar (JIRA)
java.lang.StackOverflowError when I try to use hibernate-tools-3.2.0.beta9a.jar with slf4j jars
------------------------------------------------------------------------------------------------
Key: HBX-1133
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1133
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2java
Affects Versions: 3.2.0.GA
Reporter: Ashish Zokarkar
Hello,
I am using hbm2java ant task for creation of java classes from hbm.xml files. I am using
hibernate-tools-3.2.0.beta9a.jar
hibernate3.jar
jcl-over-slf4j-1.5.8.jar
slf4j-api-1.5.8.jar
slf4j-jcl-1.5.8.jar
When I run this task, I get StackoverflowError. But when i try same ant script with
hibernate-3.1.3.jar
hibernatetools-3.1.0-b4.jar
it executed properly. But with hibernate-tools-3.2.0.beta9a & slf4j related jars I got StackOverflowExcpetion.
Ant script is as below:
<project default="hbm2java">
<property name="build.dir" location="." />
<property name="lib.dir" location="lib" />
<property name="conf.dir" location="conf" />
<path id="cp">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="hbm2java">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="cp"/>
<hibernatetool destdir="${build.dir}" classpath="${conf.dir}">
<configuration configurationfile="${conf.dir}/hibernate.cfg.xml"/>
<hbm2java jdk5="true" ejb3="false"/>
</hibernatetool>
</target>
</project>
Please suggest me how to run this command with new build. Is it a bug in this build?
--
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-611) ID generator using Oracle-style sequences with increment
by Chris Wilson (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-611?page=co... ]
Chris Wilson commented on HHH-611:
----------------------------------
This seems to be a problem with Postgres as well. The docs say:
"sequence: uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. The returned identifier is of type long, short or int"
which I feel is a bit misleading. Although it creates a sequence, it does not use the type SERIAL for the column definition, so it gets:
ritatest=# \d sequence_test
Table "public.sequence_test"
Column | Type | Modifiers
--------+---------+-----------
id | integer | not null
Indexes:
"sequence_test_pkey" PRIMARY KEY, btree (id)
and Hibernate has to hit the database a second time to retrieve the primary key. The docs imply (by omission) that the "identity" generator would not work on Postgres, but it does (http://opensource.atlassian.com/projects/hibernate/browse/HHH-1675).
The "native" strategy chooses "sequence" in postgres rather than "identity", which I think would be a much better choice given that "identity" automatically assigns IDs and "sequence" does not.
> ID generator using Oracle-style sequences with increment
> --------------------------------------------------------
>
> Key: HHH-611
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-611
> Project: Hibernate Core
> Issue Type: Patch
> Affects Versions: 3.0.5
> Environment: Hibernate 3, Oracle
> Reporter: Binil Thomas
> Assignee: Steve Ebersole
> Priority: Minor
> Attachments: caching-sequence-test.patch, caching-sequence.patch
>
>
> The org.hibernate.id.SequenceGenerator can be used to generate id's based on Oracle-style database sequences. But in its current form, this id generator does not use 'increment' option. It will hit the DB everytime it is used.
> A more efficient implementation is the org.hibernate.id.SequenceHiLoGenerator. This does not go to the DB often, but the id's generated by it can clash with those generated by other applications if they follow the DB sequence.
> In our applications, we have an Oracle sequence with increment 50 for each table - we would want all inserts into a table to pick the ID from the corresponding sequence.
> I am submitting a patch with an ID generator which accomplishes this.
--
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-4544) createNativeQuery seems to return column values by name and not by column index
by Karl Wettin (JIRA)
createNativeQuery seems to return column values by name and not by column index
-------------------------------------------------------------------------------
Key: HHH-4544
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4544
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.2.4.sp1
Reporter: Karl Wettin
Sorry, couldn't connect to the Hibernate forum, so I report it in here instead even though I'm not sure certain if it already has been solved.
Executing an SQL query using executeNativeQuery via a JPA entity manager will not return the same values in the columns as if I executed the query in my PostgreSQL prompt. The thing seems to be when I request the same field or table multiple times but using the same name.
{code:sql}
SELECT
price.currency,
price."value",
monthlyfee.currency,
monthlyfee."value",
bid.created,
auction.id,
auction.closed,
auction.firstseen,
auction.opened,
auction.lastseen,
brf.id,
brf."name",
brf.anno,
address.geocoded,
address.latitude,
address.longitude,
address.streetaddress,
address.decomposed,
address.housenumbersuffix,
address.streetname,
address.housenumber,
apartment.squaremetersexterior,
apartment.squaremetersinterior,
apartment.rooms,
apartment.floor,
genericprimaryadvertisement.sourceurl,
unharvestedprimaryadvertisement.sourceurl,
brf.organizationnumber
FROM
apartment
LEFT JOIN auction ON auction.ownable_id = apartment.id
LEFT JOIN address ON apartment.address_id = address.id
LEFT JOIN bid ON auction.mostrecentbid_id = bid.id
LEFT JOIN currency as price ON bid.price_id = price.id
LEFT JOIN currency as monthlyfee ON apartment.monthlyfee_id = monthlyfee.id
LEFT JOIN estate_apartment ON apartment.id = estate_apartment.apartments_id
LEFT JOIN estate ON estate.id = estate_apartment.estate_id
LEFT JOIN estateownership ON estate.owner_id = estateownership.id
LEFT JOIN brf ON estateownership.owner_id = brf.id
LEFT JOIN unharvestedprimaryadvertisement ON auction.primaryadvertisement_id = unharvestedprimaryadvertisement.id
LEFT JOIN genericprimaryadvertisement ON auction.primaryadvertisement_id = genericprimaryadvertisement.id
ORDER BY auction.id
{code}
In this case the value for column 0 and 1 is always equal to the value of column 2 and 3 (currency and value) when using createNativeQuery but works just fine when executing the SQL manually in psql. The same thing goes for column 25 and 26, the sourceurl columns.
As the problem disapears when I specify unique names using AS in the FROM clauses my guess is that hib iterates the column names and not the column index, i.e. treating the columns in "FROM foo.a, bar.b" as the value from foo.a in both cases.
--
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-3589) Sql generated for criteria intermittently causes "invalid identifier" error by assigning incorrect table alias to query elements
by Todd Currie (JIRA)
Sql generated for criteria intermittently causes "invalid identifier" error by assigning incorrect table alias to query elements
--------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3589
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3589
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate Core 3.3.1.GA
Oracle 10.02.03
JRE Q1.5.0_16-b02
Reporter: Todd Currie
Application is encountering intermittent ORA-00904 "invalid identifier" errors in production and test build environment. Error occurs approximately 1:460 executions in the test build environment. In each occurence it happens with a different test, but when it occurs every criteria query generated for that test class fails. In production typically causes application to crash because of the unexpected exception thrown.
The issue appears to be caused during construction of the CriteriaJoinWalker. The CriteriaLoader creates a CriteriaQueryTranslator that is responsible for the where condition and order by for non-projection queries (or additionally the select and group by for projection queries). The translator constructor is passed the CriteriaQueryTranslator.ROOT_SQL_ALIAS, "this_", which it uses for its rootSQLAlias. But when the CriteriaLoader next creates the CriteriaJoinWalker instance that is responsible for the rest of the query elements, it does not use the constructor that takes the root alias. The CriteriaJoinWalker then calls super(persister, factory, enabledFilters, alias); with a null passed in the alias parameter. The constructor in the parent class, AbstractEntityJoinWalker, calls generateRootAlias when the alias parameter is null. The method generateRootAlias is implemented both in the parent class JoinWalker and the child class CriteriaJoinWalker. To implement this form of polymorphism, java uses dynamic method binding to determine which method to call for the instance at run time. It appears that most of the time it calls the CriteriaJoinWalker implementation of generateRootAlias function which is hard coded to return CriteriaQueryTranslator.ROOT_SQL_ALIAS, "this_". The queries then generated by the CriteriaJoinWalker then execute correctly. But intermittently it calls the JoinWalker implementation which uses the passed in persistor's entityName to generate the table alias. This table alias that is then used for the rest of the query is different then the alias used by the CriteriaQueryTranslator and the resulting sql generates the invalid identifier error seen upon execution.
This can be fixed in a number of ways.
1) pass the CriteriaQueryTranslator.ROOT_SQL_ALIAS into the constructor for the CriteriaJoinWalker.
2) make the generateRootAlias abstract in the JoinWalker (less reliable).
3) use an AbstractFactory pattern to construct the objects (more work).
I have implemented #1 in our environment and am working on generating a clean test case to submit here. But for those who are interested here is the patch:
### Eclipse Workspace Patch 1.0
#P hibernate-core
Index: src/main/java/org/hibernate/loader/criteria/CriteriaLoader.java
===================================================================
--- src/main/java/org/hibernate/loader/criteria/CriteriaLoader.java (revision 15443)
+++ src/main/java/org/hibernate/loader/criteria/CriteriaLoader.java (working copy)
@@ -94,7 +94,8 @@
factory,
criteria,
rootEntityName,
- enabledFilters
+ enabledFilters,
+ CriteriaQueryTranslator.ROOT_SQL_ALIAS
);
initFromWalker(walker);
Example stack trace:
could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:615)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1051)
at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1044)
at com.onstation.service.PersistenceServiceImpl.findByCriteria(Unknown Source)
at com.onstation.service.MailingServiceTest.shouldFailToFindStateConversions(MailingServiceTest.java:52)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2231)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
at org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1061)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
Caused by: java.sql.SQLException: ORA-00904: "THIS_"."SOURCE": invalid identifier
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:810)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
Example query:
Hibernate:
select
stateconve0_.FAILEDID as FAILEDID311_0_,
stateconve0_.CREATED as CREATED311_0_,
stateconve0_.LOG as LOG311_0_,
stateconve0_.SOURCE as SOURCE311_0_
from
STATECONVERTFAILED stateconve0_
where
this_.SOURCE=?
--
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-4449) NPE during inserting new audited entity with reference to another proxy entity if proxy.lazyInitializer.session is null
by Eugene Goroschenya (JIRA)
NPE during inserting new audited entity with reference to another proxy entity if proxy.lazyInitializer.session is null
-----------------------------------------------------------------------------------------------------------------------
Key: HHH-4449
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4449
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.0.Beta-1, 3.3.2
Reporter: Eugene Goroschenya
NPE during inserting new audited entity with reference to another proxy entity if proxy.lazyInitializer.session is null
java.lang.NullPointerException
at org.hibernate.envers.tools.Tools.getTargetFromProxy(Tools.java:74)
at org.hibernate.envers.event.AuditEventListener.generateBidirectionalCollectionChangeWorkUnits(AuditEventListener.java:108)
at org.hibernate.envers.event.AuditEventListener.onPostInsert(AuditEventListener.java:152)
at org.hibernate.action.EntityIdentityInsertAction.postInsert(EntityIdentityInsertAction.java:113)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:89)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at com.jcatalog.core.persistence.hibernate.HibernateSaveOrUpdateListener.onSaveOrUpdate(HibernateSaveOrUpdateListener.java:31)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:535)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:527)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:241)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:292)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:240)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:193)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:320)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:266)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:243)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:193)
at org.hibernate.engine.Cascade.cascade(Cascade.java:154)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:479)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:357)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at com.jcatalog.core.persistence.hibernate.HibernateSaveOrUpdateListener.onSaveOrUpdate(HibernateSaveOrUpdateListener.java:31)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:535)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:527)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:523)
at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:747)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:744)
at com.jcatalog.jsfeditor.facade.HibernateEditorFacade.save(HibernateEditorFacade.java:33)
It seems It happens when hibernate session was cleared so proxy.lazyInitializer.session is set to null but this object can be used later as refernce in other entity.
Just for information such use case works OK with hibernate without Envers as far as we not try call getters of proxy with null session.
--
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-4437) ToOneDelegateSessionImplementor breaks Hibernate.getClass(auditedEntity.proxyOfnotAuditedEntity)
by Eugene Goroschenya (JIRA)
ToOneDelegateSessionImplementor breaks Hibernate.getClass(auditedEntity.proxyOfnotAuditedEntity)
------------------------------------------------------------------------------------------------
Key: HHH-4437
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4437
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.3.x
Reporter: Eugene Goroschenya
Priority: Blocker
Probably there is mistake in changes applied for HHH-4010 that leads to incorrect working of Hibernate.getClass(proxy) method.
See ToOneDelegateSessionImplementor#doImmediateLoad(String entityName)
...
Session session = versionsReader.getSession();
return session.get(entityClass, (Serializable) entityId);
...
It can return proxy but Hibernate SessionImplementor interface says
/**
* Load an instance immediately. This method is only called when lazily initializing a proxy.
* Do not return the proxy.
*/
public Object immediateLoad(String entityName, Serializable id) throws HibernateException;
Probably solution is to use delegate.doImmediateLoad(entityClass, (Serializable) entityId) instead of session.get(entityClass, (Serializable) entityId)
--
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