[Hibernate-JIRA] Created: (HHH-6238) Issue in the TypeHelper.replaceAssociations(): component properties are not processed properly
by Yury Mishchenko (JIRA)
Issue in the TypeHelper.replaceAssociations(): component properties are not processed properly
----------------------------------------------------------------------------------------------
Key: HHH-6238
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6238
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.5
Reporter: Yury Mishchenko
There seems to be an issue in the org.hibernate.type.TypeHelper.replaceAssociations() method. You can see in the source (see below) that it does not do replacement properly for components properties.
It does execute replacement for component properties but it does not apply results to the target. Thus it returns the target unchanged. I found this issue when executing a merge on an entity having a component property with an embedded set. The embedded set is never persisted. I think the fix is very simple: one needs to use results of the replacement and update the target properties. Is it feasible for the 3.6.5?
{code}
public static Object[] replaceAssociations(
final Object[] original,
final Object[] target,
final Type[] types,
final SessionImplementor session,
final Object owner,
final Map copyCache,
final ForeignKeyDirection foreignKeyDirection) {
Object[] copied = new Object[original.length];
for ( int i = 0; i < types.length; i++ ) {
if ( original[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY
|| original[i] == BackrefPropertyAccessor.UNKNOWN ) {
copied[i] = target[i];
}
else if ( types[i].isComponentType() ) {
// need to extract the component values and check for subtype replacements...
CompositeType componentType = ( CompositeType ) types[i];
Type[] subtypes = componentType.getSubtypes();
Object[] origComponentValues = original[i] == null ? new Object[subtypes.length] : componentType.getPropertyValues( original[i], session );
Object[] targetComponentValues = target[i] == null ? new Object[subtypes.length] : componentType.getPropertyValues( target[i], session );
// PROBLEM: Results of the replace is not used!!! Instead they should be used for updating target[i] properties!!!
replaceAssociations( origComponentValues, targetComponentValues, subtypes, session, null, copyCache, foreignKeyDirection );
copied[i] = target[i];
}
else if ( !types[i].isAssociationType() ) {
copied[i] = target[i];
}
else {
copied[i] = types[i].replace( original[i], target[i], session, owner, copyCache, foreignKeyDirection );
}
}
return copied;
}
{code}
--
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, 8 months
[Hibernate-JIRA] Created: (HHH-5867) Hibernate increases version on read
by Christian (JIRA)
Hibernate increases version on read
-----------------------------------
Key: HHH-5867
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5867
Project: Hibernate Core
Issue Type: Bug
Components: core, entity-manager
Affects Versions: 3.6.0, 3.6.0.CR2, 3.6.0.CR1, 3.5.6, 3.6.0.Beta4, 3.6.0.Beta3, 3.5.5, 3.6.0.Beta2, 3.6.0.Beta1, 3.5.4, 3.5.3, 3.5.2, 3.5.1, 3.5.0-Final, 3.5.0-CR-2, 3.5.0-CR-1, 3.5.0-Beta-4, 3.5.0-Beta-3, 3.5.0-Beta-2, 3.5.0.Beta-1, 3.3.2, 3.3.1, 3.3.0.SP1, 3.3.0.GA, 3.3.0.CR2, 3.3.0.CR1, 3.2.7, 3.2.6, 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0.ga, 3.2.0.cr5, 3.2.0.cr4, 3.2.0.cr3, 3.2.0.cr2, 3.2.0 cr1, 3.1.3, 3.2.0.alpha2, 3.2.0.alpha1, 3.1.2, 3.1.1, 3.1, 3.1 rc3, 3.1 rc2, 3.1 rc 1, 3.1 beta 2, 3.1 beta 1
Environment: Affects latest Hibernate version(3.6 and before). Tested with Db2 and MSSQL Server 2007.
Reporter: Christian
Priority: Critical
Attachments: TestHibernateVersionBug.zip
On a special constellation hibernate increases the internal used version of an entity on a read operation. For example if you save an entity the version is initial set. If you execute a query to read the entity afterwards, the version increases on this read. Please notice that the entity has NOT changed in the meantime. An update of the version must not happen here.
This problem seems to occur only if you have a few prequisites:
1. An entity, which has a component or subclasses
2. The component/subclasses must use an custom usertype
3. The read operation is covered by transaction
The bug leads to StaleObjectStateExceptions in production because the version has changed after a read operation by another thread.
An example is attached.
--
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, 8 months
[Hibernate-JIRA] Created: (HSEARCH-767) REGRESSION: Reindexing of @ContainedIn entities fail under certain conditions
by Kyrill Alyoshin (JIRA)
REGRESSION: Reindexing of @ContainedIn entities fail under certain conditions
-----------------------------------------------------------------------------
Key: HSEARCH-767
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-767
Project: Hibernate Search
Issue Type: Bug
Components: engine
Affects Versions: 3.4.0.Final
Reporter: Kyrill Alyoshin
Attachments: hibernate_search_bug.zip
So, I've just upgraded to 3.4.0 from 3.3.0, and one of my Hibernate Search tests fails. Here is the summary.
Let's say we have a project with two entities: Parent and Child. Let's create first Parent with a Child and a second Parent with a Child. Transaction commits. Parent is @Indexed, Child is @IndexedEmbedded.
Now, in a separate transaction, we retrieve the child of Parent 1, and move it to Parent 2. Parent 2 is detached (!). Parent 2 will fail to be re-indexed. Of course, if we re-associate Parent 2 with session, it will work. But it used to work without this. I've reproduced the problem in the attached test case.
I am really curious as what you're going to do about this bug. :-)
--
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, 8 months
[Hibernate-JIRA] Created: (HHH-2596) Add support for Hypersonic 1.8.0.7
by Gail Badner (JIRA)
Add support for Hypersonic 1.8.0.7
----------------------------------
Key: HHH-2596
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2596
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.3
Environment: Hibernate 3.2.3, Hypersonic 1.8.0.7
Reporter: Gail Badner
The version released with Hibernate 3.2.3 (1.8.0.2) is from 2005. It would be good to move to a more recent version.
The following unit tests fail when using Hypersonic 1.8.0.7:
org.hibernate.test.jpa.lock.JPALockTest.testLockModeTypeRead:
Failure: isolation not maintained expected:<lock test> but was:<updated>
org.hibernate.test.legacy.IJ2Test.testUnionSubclass:
Error: could not set a field value by reflection setter of org.hibernate.test.legacy.J.amount
org.hibernate.test.subclassfilter.UnionSubclassFilterTest.testFiltersWithUnionSubclass:
Error: Could not execute JDBC batch update
org.hibernate.test.unionsubclass.UnionSubclassTest.testUnionSubclass:
Failure: junit.framework.AssertionFailedError
org.hibernate.test.unionsubclass.UnionSubclassTest.testUnionSubclassManyToOne
Error: attempt to create delete event with null entity
--
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, 8 months