[Hibernate-JIRA] Created: (EJB-240) attribute-override and embedded in orm.xml not working
by Thomas Risberg (JIRA)
attribute-override and embedded in orm.xml not working
------------------------------------------------------
Key: EJB-240
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-240
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.ga
Environment: 3.2.0GA + HA 3.2.0GA + HEM 3.2.0GA
Reporter: Thomas Risberg
Embedding an Address class twice and need to override the column names. Using orm.xml and <embedded> plus <attribute-override> does not work while the same construct works using annotations. The orm.xml works in the RI.
<embeddable class="jpatest.Address">
<attributes>
<basic name="street"/>
<basic name="city"/>
<basic name="state"/>
<basic name="zip"/>
</attributes>
</embeddable>
<entity class="jpatest.Employee" metadata-complete="false" access="FIELD">
<attributes>
<id name="id"/>
<basic name="name"/>
<embedded name="homeAddress">
<attribute-override name="street">
<column name="home_street"/>
</attribute-override>
<attribute-override name="city">
<column name="home_city"/>
</attribute-override>
<attribute-override name="state">
<column name="home_state"/>
</attribute-override>
<attribute-override name="zip">
<column name="home_zip"/>
</attribute-override>
</embedded>
<embedded name="mailAddress">
<attribute-override name="street">
<column name="mail_street"/>
</attribute-override>
<attribute-override name="city">
<column name="mail_city"/>
</attribute-override>
<attribute-override name="state">
<column name="mail_state"/>
</attribute-override>
<attribute-override name="zip">
<column name="mail_zip"/>
</attribute-override>
</embedded>
</attributes>
</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
19 years, 4 months
[Hibernate-JIRA] Created: (ANN-425) @ManyToOne defined as @Id in a @MappedSuperclass/@EmbeddableSuperclass can't be reached by an @OneToMany(mappedBy)
by Giampaolo Tomassoni (JIRA)
@ManyToOne defined as @Id in a @MappedSuperclass/@EmbeddableSuperclass can't be reached by an @OneToMany(mappedBy)
------------------------------------------------------------------------------------------------------------------
Key: ANN-425
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-425
Project: Hibernate Annotations
Type: Bug
Versions: 3.1beta3, 3.1beta4, 3.1beta5, 3.1beta6, 3.1beta7, 3.1beta8, 3.1beta9, 3.1.0.Beta10, 3.2.0.cr1
Environment: hibernate-3.2.CR2 + hibernate-annotations-3.2.0-CR1 + hibernate-entitymanager-3.2.0-CR1 under JBoss 4.0.4-GA and EJB3
Reporter: Giampaolo Tomassoni
Attachments: test01.zip
The case in subject reports the following error:
org.hibernate.AnnotationException: mappedBy reference an unknown property: biz.tomassoni.hibernate.test01.AB.a in biz.tomassoni.hibernate.test01.A.a
It is months now that this problem had been reported (by me and by other), but no progress.
I'm attaching a testcase in the hope it can be useful.
--
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
19 years, 4 months
[Hibernate-JIRA] Created: (ANN-450) @MapKey does not work with embedded fields
by Bryan Brouckaert (JIRA)
@MapKey does not work with embedded fields
------------------------------------------
Key: ANN-450
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-450
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.0.cr3
Environment: Windows, JBoss Embedded EJB3 with the latested Hibernate Libaries (manually replaced)
Reporter: Bryan Brouckaert
@javax.persistence.MapKey does not seem to work with @embedded fields.
The following is programmed (simplified):
@Entity
public class MyClass
{
@Id
@GeneratedValue
private int id;
@MapKey(name="myKey")
private Map<KeyClass, OtherClass> myField;
...
}
@Entity
public class OtherClass
{
@Id
@GeneratedValue
private int id;
@Embedded
private KeyClass myKey;
...
}
@Embeddable
public class KeyClass
{
private String key1;
private String key2;
}
The following exception is thrown:
ERROR 11-10 08:52:30,862 (AbstractController.java:incrementState:440) -Error installing to Start: name=persistence.units:jar=sidecam.jar,unitName=sidecam state=Create
java.lang.ArrayIndexOutOfBoundsException: 1
at org.hibernate.sql.SimpleSelect.addColumns(SimpleSelect.java:41)
at org.hibernate.persister.collection.AbstractCollectionPersister.generateSelectRowByIndexString(AbstractCollectionPersister.java:894)
at org.hibernate.persister.collection.AbstractCollectionPersister.<init>(AbstractCollectionPersister.java:478)
at org.hibernate.persister.collection.OneToManyPersister.<init>(OneToManyPersister.java:60)
at org.hibernate.persister.PersisterFactory.createCollectionPersister(PersisterFactory.java:72)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:250)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:75)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installAction(LifecycleAction.java:115)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:100)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:709)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:429)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:538)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:472)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:274)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:177)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73)
at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:131)
at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:467)
at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:317)
at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:478)
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:235)
at be.sigedis.argo.sidecam.tests.ServiceCarriereTest.startupEmbeddedJboss(ServiceCarriereTest.java:55)
at be.sigedis.argo.sidecam.tests.ServiceCarriereTest$1.setUp(ServiceCarriereTest.java:41)
at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)
--
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
19 years, 4 months
[Hibernate-JIRA] Created: (ANN-448) @OrderBy does not work with an association table when Set is used for collection
by Mike Wilson (JIRA)
@OrderBy does not work with an association table when Set is used for collection
--------------------------------------------------------------------------------
Key: ANN-448
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-448
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.0.cr2
Environment: Hibernate 3.2CR4, Oracle 10
Reporter: Mike Wilson
Attachments: patch.txt
We are using Set for our mapped collections, and not Collection like in the unit tests for annotations. We can see that the items are inserted in the Set according to the order governed by @OrderBy, but apparently Hibernate is not using an order-preserving Set like f ex LinkedHashSet.
We were under the impression that Hibernate would support ordered Sets by using a suitable (ordered) Set subclass when an @OrderBy is specified and this is confirmed by Emmanuel on http://forum.hibernate.org/viewtopic.php?p=2324711.
I supply a patch file that adds a new test case to the annotations "ManyToMany" test:
GroupWithSet.java:
- property "permissions" as Set instead of Collection
ManyToManyTest.java:
- new method "testAssociationTableAndOrderByWithSet()" with:
. using GroupWithSet
. added an extra permission + check order of all three perms to avoid the 50% chance of random order being correct
(And I have tested by running against CVS HEAD version)
Best regards
Mike Wilson
--
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
19 years, 4 months
[Hibernate-JIRA] Created: (EJB-229) merge fails with detached obj in 1:1 relationship
by Juergen Zimmermann (JIRA)
merge fails with detached obj in 1:1 relationship
-------------------------------------------------
Key: EJB-229
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-229
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.cr2
Environment: JBoss 4.0.5CR1, Hibernate 3.2.0CR4, Hibernate EntityManager 3.2.0CR2, PostgreSQL 8.1.4, JDK 1.5.0_08
Reporter: Juergen Zimmermann
I'm using Hibernate EntityManager 3.2CR2 inside JBoss EJB3 CR9.
I'm invoking em.merge() with a detached object. The detached object has a 1:1 relationship with another detached object. The fetch strategy is the default strategy for 1:1 relationships. However, merge() fails and yields the stack trace below.
When I enforce loading the referenced (and also detached) object, e.g. by em.find(), then there is no problem in invoking merge() afterwards.
javax.ejb.EJBException: java.lang.ClassCastException: de.hska.kundenverwaltung.db.Firmenkunde
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
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.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:167)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:108)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
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:263)
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:828)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
Caused by: java.lang.ClassCastException: de.hska.kundenverwaltung.db.Firmenkunde
at org.hibernate.type.LongType.set(LongType.java:42)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:83)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:65)
at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1513)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1575)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1784)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.EntityLoader.loadByUniqueKey(EntityLoader.java:85)
at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1581)
at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:365)
at org.hibernate.type.EntityType.resolve(EntityType.java:306)
at org.hibernate.type.EntityType.replace(EntityType.java:207)
at org.hibernate.type.TypeFactory.replace(TypeFactory.java:437)
at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:340)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:267)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:120)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
--
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
19 years, 4 months
[Hibernate-JIRA] Created: (EJB-237) merge() causes version to increase
by Olli Blackburn (JIRA)
merge() causes version to increase
----------------------------------
Key: EJB-237
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-237
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.cr2
Environment: Core 3.2 CR4
EM 3.2 CR2
HSQLDB 1.8.0.2 in memory
Reporter: Olli Blackburn
Attachments: Playpen.zip
I'm finding that calling merge() on an unmodified entity results in the entity being marked dirty and hence its version number is increased and an SQL UPDATE performed on it.
See the attached test case (packaged as a complete eclipse 3.2 project). Set EJB3_HOME, HIBERNATE_HOME and HSQLDB_HOME in your eclipse workspace preferences and then run the included PojoTest launcher to see it run.
The test populates the DB, does a select by name, merge, merge and select by name again. Each of these five steps is in its own Tx and entity manager. The pojo is not being modified (by my code) between the merge calls(), yet I get the following output (each print is before the commit following the operation):
findByUniqueName: pojo1 version=0
merge: pojo1 version=0
merge: pojo1 version=1
findByUniqueName: pojo1 version=2
--
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
19 years, 4 months