[Hibernate-JIRA] Created: (HHH-3958) Superfluous generated updates cause Violation of UNIQUE KEY constraint
by Guenther Demetz (JIRA)
Superfluous generated updates cause Violation of UNIQUE KEY constraint
----------------------------------------------------------------------
Key: HHH-3958
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3958
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: 3.3.1 GA, SQLServer 2008
Reporter: Guenther Demetz
Priority: Minor
Attachments: Testcase.jar
When deleting a entire closure of objects associated over @ManyToOne within one single transaction, then on commit
the FlushEventListener creates update statements on objects which are going to be deleted anyway.
These update statements seems not only be useless,
in certain scenarios they lead to Constraint Violation Exceptions, see the example here:
@Entity
public class A {
public A() { }
@Id @GeneratedValue
private long oid;
}
@Entity
@Table(uniqueConstraints = {@UniqueConstraint(columnNames={"assA_oid"})})
public class B {
public B() {};
@Id @GeneratedValue
private long oid;
@javax.persistence.ManyToOne
protected A assA = null;
}
A a1 = new A(); em.persist(a1);
A a2 = new A(); em.persist(a2);
B b1 = new B();
b1.assA = a1; // set unique association
B b2 = new B();
b2.assA = a2; // set unique association
em.persist(b1);
em.persist(b2);
em.getTransaction().commit();
em.getTransaction().begin();
em.remove(a1);
em.remove(a2);
em.remove(b1);
em.remove(b2);
em.getTransaction().commit();
// p6spy report:
// update B set assA_oid='',version=0 where oid=1 and version=0
// update B set assA_oid='',version=0 where oid=2 and version=0 --> this raises "Violation of UNIQUE KEY constraint on all DB's which don't allow multiple null values in a unique index
See testcase in attachment
--
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
13 years, 11 months
[Hibernate-JIRA] Created: (HBX-1194) hibernate.hbm2ddl.auto=update works with multiple oracle schemas
by Vyacheslav (JIRA)
hibernate.hbm2ddl.auto=update works with multiple oracle schemas
----------------------------------------------------------------
Key: HBX-1194
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1194
Project: Hibernate Tools
Issue Type: Bug
Environment: <org.hibernate.core.version>3.6.8.Final</org.hibernate.core.version>
<org.hibernate.entitymanager.version>3.6.8.Final</org.hibernate.entitymanager.version>
<org.hibernate.validator.version>4.0.2.GA</org.hibernate.validator.version>
Reporter: Vyacheslav
if privileges are set hbm2ddl schema update searches for created tables in all db schemas which can be accessed, not only in current one. Don't create tables needed in current schema and fails to alter them.
http://community.jboss.org/thread/175353?tstart=0
info level log viewing says during schema update that:
table found: REALTY.DATA_EXCH_LOG
table found: REALTY_NEW.FILES_AUD
table found: SYSTEM.PROPERTIES_AUD
table found: SYSTEM.REVISIONS
Script see different database schemas and creating AUD tables in one schema scanning others:
table found: REALTY.REF_RSR_ORDER_TYPES
table found: REALTY_NEW.REF_RSR_ORDER_TYPES_AUD
After hbm2ddl cannot find tables created in other schemas:
Unsuccessful: alter table PROPERTIES_AUD add BASE_TYPE_ID number(10,0) not null
Current schema is REALTY_NEW
Very strange behaviour.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months
[Hibernate-JIRA] Created: (HHH-7247) Bug on flushing context with modified non initialized lazy collection ( It works fine on hibernate 3.5.6 )
by Hood Wilson Gusso Silva (JIRA)
Bug on flushing context with modified non initialized lazy collection ( It works fine on hibernate 3.5.6 )
----------------------------------------------------------------------------------------------------------
Key: HHH-7247
URL: https://hibernate.onjira.com/browse/HHH-7247
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: This problem occurs on hibernate 3.3.2 and 3.3.1
( The latest JPA1 hibernate implementations I've found )
Reporter: Hood Wilson Gusso Silva
Attachments: hibernateTc1.zip
This is a quite trick problem that only occurs on modified lazy collections that aren't initialized
( Like when you do a add() operation without any previous size() or get() or toString() ... )
I think that it will be easier to show it by a commented source.
I made a little database (with only 3 simple tables to make possible to reproduce the error.) + a maven project
The maven project have 2 file called pom33.xml and pom35.xml so it's possible to easily see how the error occurs on 3.3.2 but not on 3.5.6
the script to recreate the problem is available within the project too.
BTW the source do a rollback ( So it won't change the database ).
If you want changes on db it will be necessary to change the rollback() to commit()
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months