[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-450?page=co...
]
Benoit commented on ANN-450:
----------------------------
Hello,
I can report the same error even within a JAVA SE environment. The @MapKey doesn't
seem to work if the mapKey is an Embeddable field. I would really like to see this issue
fixed, thank you !
I tried to enter into Hibernate's code, through the Eclipse debugger, and it seems
that the SimpleSelect.addColumns function receives as a first argument an array of columns
with the good names (ie. the two default ones for the embedded key if it has 2 fields, or
the ones overrided) but the second array only contains 1 column name "ID1_" . I
hope this helps...
@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
Attachments: TestCase.zip
@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