[Hibernate-JIRA] Created: (HHH-6612) org.hibernate.session.isDirty() flushes new rows in a Collection which has items mapped with id generator "identity"
by Emre BAKKAL (JIRA)
org.hibernate.session.isDirty() flushes new rows in a Collection which has items mapped with id generator "identity"
--------------------------------------------------------------------------------------------------------------------
Key: HHH-6612
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6612
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core
Affects Versions: 3.0 final
Environment: Hibernate 3.0, MySql 5.5.11, JBoss 5.1, JBoss Seam 2.2.1
Reporter: Emre BAKKAL
Priority: Critical
If we call org.hibernate.session.isDirty() after we added a new row to a mapped collection in a managed Entity, dirty check forces an id assign and executes an insert.
I see that this behavior is caused by my collection items having id generator(annotated by javax.persistence.Id and javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.IDENTITY)) and mapped with cascade type "all"(javax.persistence.CascadeType.ALL), but still it's an unexpected behavior. Shouldn't it return true when it found a new row?
I couldn't find a workaround for this behavior. I wanted to give user a choice to save the changes or not, if there are changes which have been made.
Setting org.hibernate.FlushMode to "NEVER" does not help either.
This behavior prevents using this method for change tracking, and is not compatible with the description of the method..
Best Regards..
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[Hibernate-JIRA] Created: (HHH-6597) org.hibernate.session.isDirty() flushes new rows in a Collection which has items mapped with id generator "identity"
by Emre BAKKAL (JIRA)
org.hibernate.session.isDirty() flushes new rows in a Collection which has items mapped with id generator "identity"
--------------------------------------------------------------------------------------------------------------------
Key: HHH-6597
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6597
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core
Affects Versions: 3.0 final
Environment: JBoss 5.1, JBoss Seam 2.2.1, Hibernate 3.0, MySql 5.5.11
Reporter: Emre BAKKAL
If we call org.hibernate.session.isDirty() after we add a new row to a mapped collection in a managed Entity, dirty check forces an id assign and executes an insert.
I see that this behavior is caused because of my collection items having id generator and mapped with cascade type all, but still it's an unexpected behavior. Shouldn't it return true when it found a new row?
I couldn't find a workaround for this behavior. I wanted to give user a choice to save the changes or not, if there are changes which have been made.
Setting FlushMode to NEVER does not help either.
This behavior prevents using this method for change tracking, and is not compatible with the description of the method..
Best Regards..
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[Hibernate-JIRA] Created: (HHH-5894) [ENVERS] Loading collections from envers entity fails due to QueryException
by Sven Rienstra (JIRA)
[ENVERS] Loading collections from envers entity fails due to QueryException
---------------------------------------------------------------------------
Key: HHH-5894
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5894
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.1
Environment: Hibernate 3.6.1
Oracle 10g
Ubuntu
Reporter: Sven Rienstra
Priority: Blocker
When I'm trying to load a collection from an envers entity it fails due to an incorrect HQL query:
Caused by: org.hibernate.QueryException: could not resolve property: domein_id of: nl.protopics.zwip.model.gvo.Faq_AUD [select e from nl.protopics.zwip.model.gvo.Faq_AUD e where e.domein_id = :domein_id and e.originalId.REV.id = (select max(e2.originalId.REV.id) from nl.protopics.zwip.model.gvo.Faq_AUD e2 where e2.originalId.REV.id <= :revision and e.originalId.id = e2.originalId.id) and REVTYPE != :delrevisiontype]
at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:81)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:75)
at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1465)
at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:315)
at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:487)
at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:611)
at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:263)
at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:210)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:117)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:113)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:880)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1330)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4471)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3944)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2047)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1972)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1972)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:831)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:617)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
at org.hibernate.envers.entities.mapper.relation.query.OneAuditEntityQueryGenerator.getQuery(OneAuditEntityQueryGenerator.java:99)
at org.hibernate.envers.entities.mapper.relation.lazy.initializor.AbstractCollectionInitializor.initialize(AbstractCollectionInitializor.java:62)
at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.checkInit(CollectionProxy.java:50)
at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.iterator(CollectionProxy.java:70)
mappings:
Domein class, from where I call getFaqs()
@OneToMany(cascade = CascadeType.ALL, mappedBy = "domein")
private List<Faq> faqs = new ArrayList<Faq>();
Faq mapping:
@ManyToOne
private Domein domein;
Works fine with 3.6.0.
--
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
14 years, 7 months