[Hibernate-JIRA] Commented: (HHH-1582) PostInsertListener + "post-commit-insert"
by Holger Wagner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1582?page=c... ]
Holger Wagner commented on HHH-1582:
------------------------------------
Here is an stack-trace for this situation:
EntityInsertAction.postCommitInsert() line: 126
EntityInsertAction.afterTransactionCompletion(boolean) line: 162
ActionQueue.afterTransactionCompletion(boolean) line: 170
SessionImpl.afterTransactionCompletion(boolean, Transaction) line: 419
JDBCContext.afterTransactionCompletion(boolean, Transaction) line: 209
JDBCTransaction.rollback() line: 174
HibernateTransactionManager.doRollback(DefaultTransactionStatus) line: 603
HibernateTransactionManager(AbstractPlatformTransactionManager).processRollback(DefaultTransactionStatus) line: 583
HibernateTransactionManager(AbstractPlatformTransactionManager).rollback(TransactionStatus) line: 560
AbschnittDao(RevisionDao<T>).runInTransaction(Runnable) line: 622
AbschnittDao(RevisionDao<T>).update(T) line: 571
> PostInsertListener + "post-commit-insert"
> -----------------------------------------
>
> Key: HHH-1582
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1582
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.1.2
> Reporter: Daniel Gredler
> Assignee: Emmanuel Bernard
> Original Estimate: 3 hours
> Remaining Estimate: 3 hours
>
> I'm using a custom PostInsertEventListener mapped to the "post-commit-insert" event to process domain objects. However, PostInsertEventListener's onPostInsert(PostInsertEvent) is getting called even when the insert was not successful (ie, due to a unique constraint in the database or some such). It looks to me like Hibernate should either a) not invoke the event listener if the insert failed or b) provide state (perhaps in the form of a boolean indicating success/failure). Personally I'd rather the method not be called on failure, but there may be use cases out there for the second option.
> As an example, it looks like Hibernate's own LuceneEventListener will add a domain object to the index in onPostInsert(PostInsertEvent) even if the insert failed.
> Note that this problem also seems to exist in EntityDeleteAction and EntityUpdateAction (which would mean that Hibernate's LuceneEventListener removes domain objects from the Lucene index even if the delete fails!).
--
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, 2 months
[Hibernate-JIRA] Commented: (HHH-1268) Unidirection OneToMany causes duplicate key entry violation when removing from list
by Loïc Lefèvre (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1268?page=c... ]
Loïc Lefèvre commented on HHH-1268:
-----------------------------------
Hello, any news about the resolution of this issue?
> Unidirection OneToMany causes duplicate key entry violation when removing from list
> -----------------------------------------------------------------------------------
>
> Key: HHH-1268
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1268
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.1
> Environment: 3.1 final
> MySql 4.1.14 using MYISAM tables
> Reporter: Rex Madden
> Assignee: Gail Badner
> Fix For: 3.2.x, 3.3.x
>
> Attachments: src.zip
>
>
> Simple OneToMany parent/child relationship using the default table structure (2 tables and a join table)
> Add 3 children to the parent. Flush. Remove the first child. Flush throws error:
> Exception in thread "main" org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
> at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
> at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
> at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)
> at UnidirectionalOneToManyRemoveFromListBug.main(UnidirectionalOneToManyRemoveFromListBug.java:27)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
> Caused by: java.sql.BatchUpdateException: Duplicate key or integrity constraint violation, message from server: "Duplicate entry '5' for key 2"
> at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1461)
> at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
> ... 11 more
> The problem is that there is a unique key on the relationship table that gets violated. The session removes the last row in the relationship table, then attempts to rewrite the child_id's. It fails since there is a uniqueness constraint on that column.
--
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, 2 months
[Hibernate-JIRA] Commented: (HHH-1582) PostInsertListener + "post-commit-insert"
by Holger Wagner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1582?page=c... ]
Holger Wagner commented on HHH-1582:
------------------------------------
I've tried the 3.3.2-Version and got the same behavior - so I checked the 'bad'-call coming from the rollback-method by adding a transient flag to my objects.
When you will really fix this problem?
> PostInsertListener + "post-commit-insert"
> -----------------------------------------
>
> Key: HHH-1582
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1582
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.1.2
> Reporter: Daniel Gredler
> Assignee: Emmanuel Bernard
> Original Estimate: 3 hours
> Remaining Estimate: 3 hours
>
> I'm using a custom PostInsertEventListener mapped to the "post-commit-insert" event to process domain objects. However, PostInsertEventListener's onPostInsert(PostInsertEvent) is getting called even when the insert was not successful (ie, due to a unique constraint in the database or some such). It looks to me like Hibernate should either a) not invoke the event listener if the insert failed or b) provide state (perhaps in the form of a boolean indicating success/failure). Personally I'd rather the method not be called on failure, but there may be use cases out there for the second option.
> As an example, it looks like Hibernate's own LuceneEventListener will add a domain object to the index in onPostInsert(PostInsertEvent) even if the insert failed.
> Note that this problem also seems to exist in EntityDeleteAction and EntityUpdateAction (which would mean that Hibernate's LuceneEventListener removes domain objects from the Lucene index even if the delete fails!).
--
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, 2 months
[Hibernate-JIRA] Created: (ANN-794) Polymorphic query on abstract function
by radu (JIRA)
Polymorphic query on abstract function
--------------------------------------
Key: ANN-794
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-794
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Reporter: radu
Priority: Blocker
I have the following classes adnnotated with hibernate:
<pre><code>
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class Symbol
implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@AccessType("property")
public abstract String getCode();
@AccessType("property")
public abstract void setCode(String code);
}
@javax.persistence.Entity
@AttributeOverride( name="code", column = @Column(name="field1") )
public class Child1 extends Symbol {
@Basic
@Column(nullable = false)
private String field1;
@AccessType("property")
public String getCode() {
return getField1();
}
@AccessType("property")
public void setCode(String code) {
setField1(code);
}
public void setField1(String field1) {
this.field1 = field1;
}
public String getField1() {
return field1;
}
}
@javax.persistence.Entity
@AttributeOverride( name="code", column = @Column(name="field2") )
public class Child2 extends Symbol {
@Basic
@Column(nullable = false)
private String field2;
@AccessType("property")
public String getCode() {
return getField2();
}
@AccessType("property")
public void setCode(String code) {
setField1(code);
}
public void setField1(String field2) {
this.field2 = field2;
}
public String getField2() {
return field2;
}
}
</code></pre>
As objectual rules about polymorphisms the following query should be valid and to retrieve correct field value:
session.createQuery("from Symbol s where s.code = :code");
but it give me the error:
org.hibernate.QueryException: could not resolve property: code of: ...
Please give some advices how to work around this problem if this situation does not follow hibernate concept or JPA specs and is not possible to implement it.
Idea is that it should be possible to work at hight level without changing database or existing classes.
Thanks
--
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, 2 months