[Hibernate-JIRA] Commented: (HHH-572) Repeated columns rejected in a collection of composite elements
by Frido van Orden (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-572?page=co... ]
Frido van Orden commented on HHH-572:
-------------------------------------
The workaround with a formula does not work if the many-to-one inside the composite-element is composite itself. In that case, a NPE occurs:
java.lang.NullPointerException
at org.hibernate.util.StringHelper.qualify(StringHelper.java:287)
at org.hibernate.util.StringHelper.qualify(StringHelper.java:301)
at org.hibernate.loader.JoinWalker.walkCompositeElementTree(JoinWalker.java:522)
at org.hibernate.loader.JoinWalker.walkCollectionTree(JoinWalker.java:333)
at org.hibernate.loader.JoinWalker.walkCollectionTree(JoinWalker.java:278)
at org.hibernate.loader.collection.BasicCollectionJoinWalker.<init>(BasicCollectionJoinWalker.java:70)
at org.hibernate.loader.collection.BasicCollectionLoader.<init>(BasicCollectionLoader.java:76)
at org.hibernate.loader.collection.BasicCollectionLoader.<init>(BasicCollectionLoader.java:63)
at org.hibernate.loader.collection.BasicCollectionLoader.<init>(BasicCollectionLoader.java:54)
at org.hibernate.loader.collection.BatchingCollectionInitializer.createBatchingCollectionInitializer(BatchingCollectionInitializer.java:115)
at org.hibernate.persister.collection.BasicCollectionPersister.createCollectionInitializer(BasicCollectionPersister.java:320)
at org.hibernate.persister.collection.AbstractCollectionPersister.postInstantiate(AbstractCollectionPersister.java:563)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:326)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
> Repeated columns rejected in a collection of composite elements
> ---------------------------------------------------------------
>
> Key: HHH-572
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-572
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: JRE 1.4.2_08
> Reporter: Emmanuel Bourg
> Assignee: Gavin King
> Priority: Minor
>
> Repeating a column in a collection of composite elements triggers an error when the mapping is parsed, even if the property with the repeated column has the insert and update attributes set to false:
> <set name="children" table="CHILDREN">
> <key column="PARENT_ID"/>
> <composite-element class="Child">
> <property name="parentId" column="PARENT_ID" insert="false" update="false" />
> </composite-element>
> </set>
> or
> <set name="roles" table="ROLE">
> <key column="PARENT_ID"/>
> <composite-element class="Role">
> <many-to-one name="child" class="Child"/>
> <property name="childId" column="CHILD_ID" insert="false" update="false" />
> </composite-element>
> </set>
> Hibernate throws this exception:
> org.hibernate.MappingException: Repeated column in mapping for collection: Parent.children column: PARENT_ID
> at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:275)
> at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:298)
> at org.hibernate.mapping.Collection.validate(Collection.java:255)
> at org.hibernate.mapping.Set.validate(Set.java:19)
> at org.hibernate.cfg.Configuration.validate(Configuration.java:817)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:976)
> a workaround is to use a formula:
> <set name="children" table="CHILDREN">
> <key column="PARENT_ID"/>
> <composite-element class="Child">
> <property name="parentId" formula="PARENT_ID"/>
> </composite-element>
> </set>
> This works fine with the fix for HHH-539
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (EJB-331) StaleObjectStateException after removing two entities
by ludki (JIRA)
StaleObjectStateException after removing two entities
-----------------------------------------------------
Key: EJB-331
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-331
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.1.GA
Environment: Hibernate EntityManager 3.3.1.GA
Hibernate Annotations 3.3.0.GA
Hibernate Core 3.2.5
Oracle 9.2.0.7.0
Oracle JDBC driver 10.1.0.4.0
Reporter: ludki
Attachments: test.zip
The szenrio is very simple : we have two entities EntityA, EntityB with a relation (EntityA.eB <-> EntityB.eA) between them.
The foreign key 'eB_id' is located at the table of EntityA.
The Lock-Strategy of both Entities is
@org.hibernate.annotations.Entity(optimisticLock = org.hibernate.annotations.OptimisticLockType.DIRTY, dynamicUpdate = true)
The initial state can be reached as follows:
@PersistenceContext
EntityManager m;
public void create() {
EntityA a = new EntityA(1); // PrimaryKey = 1
EntityB b = new EntityB(1); // PrimaryKey = 1
a.eB = b;
b.eA = a;
m.persist(a);
m.persist(b);
}
in a new Transaction (or after a flush) we have first to release the relation between the two Entities and then remove them. For getting the Exception it is important to remove the Entity which contains the foreign key at last:
private void remove() {
EntityA a = m.find(EntityA.class, 1);
EntityB b = m.find(EntityB.class, 1);
m.remove(b);
m.remove(a);
}
A flush before the removes or switching the two removes will prevent the Exception.
The generated (and obviously erroneous) SQL-Statements for the remove-method are listed below:
update EntityA set eB_id=null where key=1 and eB_id=1
delete from EntityB where key=1
delete from EntityA where key=1 and eB_id = 1 <-- eB_id was set to null two lines ago, therefore the delete causes an EntityNotFoundException
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [test.EntityA#1]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2523)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:516)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1389)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
javax.persistence.EntityNotFoundException: Unable to find test.EntityA with id 1
at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:109)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:797)
at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:640)
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:600)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:525)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1389)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
--
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
16 years, 1 month
[Hibernate-JIRA] Commented: (HBX-524) Reverse of one-to-one relationships
by Nick Grant (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Nick Grant commented on HBX-524:
--------------------------------
Why can't I see these changes in the 3.2.4.CR1 nightly build? The DTD etc. is still out of date.
Desperate to get hold of these changes as quick as I can - I've been waiting for reverse engineering of one-to-one relationships for ages!
Thanks,
Nick
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
> Assignee: Anthony Patricio
> Fix For: 3.2.4.CR1
>
> Attachments: HBX-524.patch, HBX-524v2.patch, one-to-one-marcio.patch, patch.txt
>
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (HSEARCH-185) Add selective property embedding in @IndexedEmbedded
by Stephane Epardaud (JIRA)
Add selective property embedding in @IndexedEmbedded
----------------------------------------------------
Key: HSEARCH-185
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-185
Project: Hibernate Search
Issue Type: New Feature
Components: mapping
Affects Versions: 3.0.1.GA
Reporter: Stephane Epardaud
Priority: Minor
We use @IndexedEmbedded for two reasons:
- Filtering entities based on some embedded entity fields in a HS filter
- Searching through the "text" field of every entity embedded in a root entity
If we could specify the fields that we embed we would not need to embed a whole entity in the index. For instance we don't need to embed its ID in most cases, or fields which might be useful for one embedding and not another one.
If we could add the following to the @IndexedEmbedded annotation:
String[] fields() default {};
We could achieve the desired goal. An empty value would mean "embed all the fields" (this is still subject to depth), while a non-empty value would mean "only embed those fields" (still subject to depth).
This would be ideal in our current case if combined with @IndexedEmbeddeds: in our example, we have an Order entity which has several "actors" such as _buyer_ and _seller_. We need to embed the keys of those actors in the Order index in order to use them from our HS filter. We also have several "text" fields in Order and there are some in Person which we'd like to embed:
{code}
@Indexed
@Entity
public void Order implements Serializable {
...
@IndexedEmbeddeds({
// this is used by the filter for security
@IndexedEmbedded(prefix="contacts.", fields={"key"}, depth=1),
// this is for full-text search
@IndexedEmbedded(prefix="", fields={"text"}, depth=1)
})
private Person buyer;
@IndexedEmbeddeds({
// this is used by the filter for security
@IndexedEmbedded(prefix="contacts.", fields={"key"}, depth=1),
// this is for full-text search
@IndexedEmbedded(prefix="", fields={"text"}, depth=1)
})
private Person seller;
@Field(name = "text", index = Index.TOKENIZED)
private String description;
...
}
@Indexed
@Entity
public class Person implements Serializable {
...
@Fields({
// this is for full-text search
@Field(name = "text"),
// this is for security checks in the filters
@Field(name = "key", index = Index.UN_TOKENIZED, store = Store.YES)
)}
private String key;
@Field(name = "text", index = Index.TOKENIZED)
private String name;
}
{code}
What do you think?
This is a real-world requirement, and I don't think it should be too difficult to implement so if you agree with its usefulness I'm ready to back it up with a patch.
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (HHH-3601) composite-id and association with property-ref causing PropertyAccessException
by Anthony Patricio (JIRA)
composite-id and association with property-ref causing PropertyAccessException
------------------------------------------------------------------------------
Key: HHH-3601
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3601
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Reporter: Anthony Patricio
Attachments: CidAndPropertyRefBug.zip
Order has a composite id
We also have Order OneToMany LineItem using a property-ref, see attached testcase (build from 3.3.1 core test suite project)
when trying to load the collection, following exception is raised
10:35:50,046 ERROR BasicPropertyAccessor:191 - IllegalArgumentException in class: org.hibernate.test.cid.propertyref.Order$Id, getter method of property: customerId
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of org.hibernate.test.cid.propertyref.Order$Id.customerId
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:195)
at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:87)
at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:93)
at org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:109)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:376)
at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:207)
at org.hibernate.engine.EntityKey.generateHashCode(EntityKey.java:126)
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:70)
at org.hibernate.engine.StatefulPersistenceContext.getCollectionOwner(StatefulPersistenceContext.java:701)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1016)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:669)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:614)
at org.hibernate.loader.Loader.doQuery(Loader.java:724)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.loadCollection(Loader.java:2015)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1743)
at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:476)
at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:867)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:264)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.test.cid.propertyref.CompositeIdTest.testQuery(CompositeIdTest.java:59)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at org.hibernate.junit.functional.FunctionalTestCase.runTest(FunctionalTestCase.java:125)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:63)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
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 org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:169)
... 48 more
May be the same source as
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2843
where user is reporting
"I think this is a bug. After adding some extra debugging to the hibernate code, Hibernate is passing in an array of of the properties and trying to call the getter on the array instead of the containing object. "
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (HHH-3600) exception while saving bidirectional association
by Itai Peleg (JIRA)
exception while saving bidirectional association
-------------------------------------------------
Key: HHH-3600
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3600
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: hql+collection
Environment: spring 2.5, envers 1.1.0.GA-hibernate-3.3, hibernate 3.3.1, hsqldb 1.8.0.7
Reporter: Itai Peleg
Priority: Critical
Attachments: envers.zip
when adding the listeners
<listener type="post-collection-recreate" class="org.jboss.envers.event.VersionsEventListener"/>
<listener type="pre-collection-remove" class="org.jboss.envers.event.VersionsEventListener"/>
<listener type="pre-collection-update" class="org.jboss.envers.event.VersionsEventListener"/>
the bidirectional association between entities cause an exception that thrown while saving the revision entities.
2008-11-12 08:21:56,957 ERROR [JDBCTransaction] - exception calling user Synchronization
org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.digit
altrowel.model.extractions.organization.Employment.createdByStepExecution at org.hibernate.property.
DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:58)
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.getForInsert(DirectPropertyAccessor.j
ava:63)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getPropertyValuesToInsert(AbstractEntityTupliz
er.java:294)
at org.hibernate.tuple.entity.PojoEntityTuplizer.getPropertyValuesToInsert(PojoEntityTuplizer.java:
239)
at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyValuesToInsert(AbstractEntityP
ersister.java:3696)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListen
er.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204
)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.
java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultS
aveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEvent
Listener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEv
entListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.ja
va:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEvent
Listener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
at org.jboss.envers.synchronization.work.PersistentCollectionChangeWorkUnit.perform(PersistentColle
ctionChangeWorkUnit.java:67)
at org.jboss.envers.synchronization.VersionsSync.executeInSession(VersionsSync.java:120)
at org.jboss.envers.synchronization.VersionsSync.beforeCompletion(VersionsSync.java:144)
at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion(JDBCTrans
action.java:274)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:140)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionMana
ger.java:655)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(Abstrac
tPlatformTransactionManager.java:709)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatfo
rmTransactionManager.java:678)
at com.digitaltrowel.test.AbstractTransactionalSpringContextTest$TransactionContext.endTransaction(
AbstractTransactionalSpringContextTest.java:243)
at com.digitaltrowel.test.AbstractTransactionalSpringContextTest.endTransaction(AbstractTransaction
alSpringContextTest.java:201)
at com.digitaltrowel.test.AbstractTransactionalSpringContextTest.commit(AbstractTransactionalSpring
ContextTest.java:195)
at com.digitaltrowel.test.data.DataGenerationTest.testCreateData(DataGenerationTest.java:55)
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:597)
at org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:163)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java
:233)
at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(Spri
ngMethodRoadie.java:333)
at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie
.java:217)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4Cla
ssRunner.java:142)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.IllegalArgumentException: Can not set com.digitaltrowel.model.batch.metadata.Ba
tchStepExecution field com.digitaltrowel.model.versionedentity.VersionedEntity.createdByStepExecutio
n to java.util.HashMap
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.jav
a:146)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.jav
a:150)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
at java.lang.reflect.Field.get(Field.java:358)
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:55)
... 48 more
see attached test case.
Note that the test pasted but exception written in the stack trace!
--
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
16 years, 1 month