[Hibernate-JIRA] Created: (HHH-4810) Persistent immutable and read-only entities are updated before being deleted
by Gail Badner (JIRA)
Persistent immutable and read-only entities are updated before being deleted
----------------------------------------------------------------------------
Key: HHH-4810
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4810
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Beta-3
Reporter: Gail Badner
Assignee: Gail Badner
Fix For: 3.5.0-Beta-4
Read-only and immutable entities that are in persistent state when deleted are updated before being deleted. Read-only and immutable entities that are detached when deleted are not updated before being deleted.
In the following examples, Contract is an immutable class.
Example 1: Immutable entity is updated with the same property values as just read
s = openSession();
t = s.beginTransaction();
c = (Contract) s.get( Contract.class, c.getId() );
s.delete(c);
t.commit();
s.close();
Hibernate: update Contract set customerName=?, type=? where id=?
17:59:32,640 TRACE StringType:151 - binding 'gavin' to parameter: 1
17:59:32,640 TRACE StringType:151 - binding 'phone' to parameter: 2
17:59:32,641 TRACE LongType:151 - binding '1' to parameter: 3
... (immutable collection, Contract.getVariations() is also updated and deleted)
Hibernate: delete from Contract where id=?
17:59:32,654 TRACE LongType:151 - binding '1' to parameter: 1
-------------------------------------------------------------------------
Example 2: Immutable entity is updated with a new property value before being deleted
s = openSession();
t = s.beginTransaction();
c = (Contract) s.get( Contract.class, c.getId() );
c.setCustomerName( "Sherman" );
s.delete(c);
t.commit();
s.close();
Hibernate: update Contract set customerName=?, type=? where id=?
17:59:33,221 TRACE StringType:151 - binding 'Sherman' to parameter: 1
17:59:33,221 TRACE StringType:151 - binding 'phone' to parameter: 2
17:59:33,222 TRACE LongType:151 - binding '6' to parameter: 3
... (immutable collection, Contract.getVariations() is also updated and deleted)
Hibernate: delete from Contract where id=?
17:59:33,242 TRACE LongType:151 - binding '6' to parameter: 1
Example 3: No update when the immutable entity is detached when it is deleted.
s = openSession();
t = s.beginTransaction();
s.delete( c );
t.commit();
s.close();
... (immutable collection, Contract.getVariations() is deleted)
Hibernate: delete from Contract where id=?
17:59:33,337 TRACE LongType:151 - binding '8' to parameter: 1
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-4825) mapping order impacting behavior leading to bug
by Anthony Patricio (JIRA)
mapping order impacting behavior leading to bug
-----------------------------------------------
Key: HHH-4825
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4825
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Reporter: Anthony Patricio
Following mapping fails:
<hibernate-mapping default-access="property" package="case419703">
<class abstract="false" dynamic-insert="true" dynamic-update="true" name="TestB"
table="TEST_B">
<composite-id class="case419703.key.FrameworkKeyCustID"
name="frameworkKey">
<key-property column="NR_RZBK" name="frameworkCustId"/>
<key-property column="TXT_OID" name="frameworkOid"/>
</composite-id>
<version column="NR_VERSION" name="frameworkVersion"/>
<set cascade="persist, merge, save-update" inverse="true" lazy="true" name="testC">
<key>
<column name="NR_RZBK"/>
<column name="TXT_OID_TESTB"/>
</key>
<one-to-many class="TestC"/>
</set>
</class>
<class abstract="true" dynamic-insert="true" dynamic-update="true" name="AbstractTestC"
table="notable">
<composite-id class="case419703.key.FrameworkKeyCustID"
name="frameworkKey">
<key-property column="NR_RZBK" name="frameworkCustId"/>
<key-property column="TXT_OID" name="frameworkOid"/>
</composite-id>
<version column="NR_VERSION" name="frameworkVersion"/>
<union-subclass dynamic-insert="true" dynamic-update="true" name="case419703.TestC"
table="TEST_C">
<property column="PID" name="pid" update="false"/>
<property column="TXT_OID_TESTB" name="fkReverseTestB"/>
<many-to-one cascade="persist, merge, save-update" class="case419703.TestB"
fetch="select" insert="false" lazy="no-proxy" name="reverseTestB"
update="false" >
<column name="NR_RZBK" />
<column name="TXT_OID_TESTB" />
<!-- formula>'TXT_OID_TESTB'</formula-->
</many-to-one>
</union-subclass>
</class>
</hibernate-mapping>
however changing to
<many-to-one cascade="persist, merge, save-update" class="case419703.TestB"
fetch="select" insert="false" lazy="no-proxy" name="reverseTestB"
update="false" >
<column name="NR_RZBK" />
<column name="TXT_OID_TESTB" />
<!-- formula>'TXT_OID_TESTB'</formula-->
</many-to-one>
<property column="PID" name="pid" update="false"/>
<property column="TXT_OID_TESTB" name="fkReverseTestB"/>
works.
Something is wrong with th algo.
See attached testcase.
--
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, 10 months
[Hibernate-JIRA] Created: (ANN-660) HHH-2545 Alive
by Eugene Batogov (JIRA)
HHH-2545 Alive
--------------
Key: ANN-660
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-660
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: Gentoo Linux x86
JDK: 1.6. SUN and BEA
JBoss-4.2.1.GA
Hibernate: 3.2.5
Annotation: 3.3.0.GA
EntityManager: 3.3.1
Reporter: Eugene Batogov
Priority: Critical
I have a same problem how in HHH-2545 bug !
I update Hibernate to 3.2.5, hibernate-annotation to 3.3.0.GA
hibernate-entitymanager to 3.3.1.GA.
But this bug alive!
I use ehcache-1.3.0. jBoss-4.2.1.GA.
My query, which get from cache with null elements in collections:
Long customerAccount = customerIdentity.getCustomerAccount().getId();
try{
String sql = "select npvr.npvrChannels from NpvrServiceSpec npvr"+
" where npvr.id in ("+
" select ss.id from Customer cust join cust.accounts acc join
cust.subscriptions sub"+
" join sub.serviceSpecifications ss"+
" where acc.id =:customerAccount and"+
" ss in (from NpvrServiceSpec))";
Query query = emanager.createQuery(sql);
query.setParameter("customerAccount", customerAccount);
query.setHint("org.hibernate.cacheRegion", "query.findQueryNpvrChannelsBySubsription");
query.setHint("org.hibernate.cacheable", true);
result = query.getResultList();
Help me, please !
Thanks in advance.
--
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, 10 months