| Summary: | using getID on an entity with EmbeddedId of derived primay keys will fail with IAE | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | elhanan Maayan <elh.mailgate> | ||||
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.orm-inbox> | ||||
| Status: | NEW --- | QA Contact: | |||||
| Severity: | critical | ||||||
| Priority: | P2 | CC: | akochnev, tom.ware | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 208798 [details]
attached test project
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next. *** Bug 392006 has been marked as a duplicate of this bug. *** The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
assume you have book which has many to one publisher and many to one author BookPK is the embeddedId which has to 2 int columns if i try the following: EntityManagerFactory emf = Persistence.createEntityManagerFactory("elTest"); EntityManager em = emf.createEntityManager(); Metamodel metamodel = em.getMetamodel(); EntityType<Book> entity = metamodel.entity(Book.class); Type<?> idType = entity.getIdType(); Class<?> javaType = idType.getJavaType(); SingularAttribute<? super Book, ?> id = entity.getId(javaType); // problem here! org.junit.Assert.assertNotNull(id); i will always get IAE exception no matter what java type i send in. this is becuase the loop inside getId tries to compare ALL idAttributes so if passes the first one, the next one will fail, the only thing that works is sending in a null or Object class this DOES work in hibernate, and an embedded id that is not mapped to derived keys