Issues
- JoinColumn on non key field fails to populate collectionHHH-6204Resolved issue: HHH-6204Steve Ebersole
- HqlLexer can cause ClassNotFound in OSGi environmentHHH-6165Resolved issue: HHH-6165
- HSQLDialect support for ROWNUMHHH-6012Resolved issue: HHH-6012
- Methos generate in org.hibernate.id.enhanced.OptimizerFactory$PooledLoOptimizer classs is not synchronizedHHH-5872Resolved issue: HHH-5872
- Hibernate increases version on readHHH-5867Resolved issue: HHH-5867Strong Liu
- Entities can't also be MappedSuperclassesHHH-5822Resolved issue: HHH-5822
- Hibernate 3.5.4 doesn't build with OpenJDK 6b18-1.8.2 or greaterHHH-5789Resolved issue: HHH-5789Strong Liu
- Hibernate complains about an unknown mappedBy property when mapping a bidirectional OneToOne relation with a derived identifierHHH-5695Resolved issue: HHH-5695Brett Meyer
- Using compound primary key throws SQLExceptionHHH-5675Resolved issue: HHH-5675
- FilterOverrides AnnotationHHH-5674Resolved issue: HHH-5674
- JPA 2 orphanRemoval on OneToOne relation does not work properlyHHH-5559Resolved issue: HHH-5559Emmanuel Bernard
- DbTimestamp uses local time for @Version field on Oracle 11gHHH-5553Resolved issue: HHH-5553
- Change from class to interface leads to IncompatibleClassChangeError (org.hibernate.stat.EntityStatistics and co.)HHH-5541Resolved issue: HHH-5541
- The interface method org.hibernate.id.ResultSetIdentifierConsumer.consumeIdentifier(ResultSet resultSet) should throw SQLExceptionHHH-5486
- Default for CHECK_NULLABILITY does not allow merge retriesHHH-5473Resolved issue: HHH-5473Former user
- HHH-3659 is only half done, due to HHH-4989 (i.e. no HQL performance log when running Java 5)HHH-5469Resolved issue: HHH-5469Steve Ebersole
- ByteCodeHelper.readByteCode won't load classes bigger than a constant sizeHHH-5453Resolved issue: HHH-5453Steve Ebersole
- Documentation bug - reference contains a wrong POM in the tutorial sectionHHH-5448Resolved issue: HHH-5448Steve Ebersole
- Add identity column support to the Ingres10DialectHHH-5435Resolved issue: HHH-5435Strong Liu
- org.hibernate.test.filter.DynamicFilterTest testSqlSyntaxOfFiltersWithUnions fails with Ingres dialectHHH-5434Resolved issue: HHH-5434Strong Liu
- Mapping gets confused if superclasses are in different packages.HHH-5432Resolved issue: HHH-5432
- Infinispan's CacheAdapterImpl.putAllowingTimeout not using silent flagHHH-5431Resolved issue: HHH-5431Galder Zamarreno
- [regression] unable to persist entity using derby 10.6.1.0 and hibernate 3.5+HHH-5429Resolved issue: HHH-5429Former user
- collection tables are improperly non-quoted when the owning table is quotedHHH-5428Resolved issue: HHH-5428Steve Ebersole
- derby 10.6.1.0 native sequence support brokenHHH-5427Resolved issue: HHH-5427Steve Ebersole
- PropertyAccessException when caching results from a Query with a ResultTransformer that as 1 value per rowHHH-5425Resolved issue: HHH-5425Former user
- COUNT operator with composite primary key and JPA 2.0 Criteria API produces bad sqlHHH-5419Resolved issue: HHH-5419Former user
- Have Configuration delay parsing/binding of mappings until buildMappings() is calledHHH-5418Resolved issue: HHH-5418Steve Ebersole
- upgrade to h2 1.2.140HHH-5416Resolved issue: HHH-5416Steve Ebersole
- org.hibernate.type.descriptor.java.DataHelper dumping "NClob not found" exception to stderrHHH-5415Resolved issue: HHH-5415Steve Ebersole
- null values for columns mapped as "boolean" cause exception when saving entity with Sybase jdbc4HHH-5413Resolved issue: HHH-5413Strong Liu
- Revise JPA compliance wording used in documentation according to Oracle policiesHHH-5408Resolved issue: HHH-5408Emmanuel Bernard
- Improve envers query performance by using new REVEND columnHHH-5372Resolved issue: HHH-5372AdamA
- Add support for REVEND_TSTMP which will enable SQL table partitioning by timeHHH-5371Resolved issue: HHH-5371Erik-Berndt Scheper
- a few typo fixes in Dialect and in testsHHH-5335Resolved issue: HHH-5335Steve Ebersole
- Tests fail on mysqlHHH-5324Resolved issue: HHH-5324Strong Liu
- Multi-Level cascading of unsaved instances with bidirectional associations fails with TransientObjectException (Carl-Eric Menzel)HHH-5299Resolved issue: HHH-5299Former user
- Use intern() to reuse strings and reduce memory usage / save 6%HHH-5232Resolved issue: HHH-5232Former user
- Allow usage of standalone @JoinFormula annotationHHH-5171Resolved issue: HHH-5171Sharath Reddy
- EnumType speed up in initEnumValues()HHH-5147Resolved issue: HHH-5147Hardy Ferentschik
- ChainedPropertyAccessor is not serializable, which breaks caching to disk and replicated caches.HHH-4011Resolved issue: HHH-4011Former user
- override equals() and fix hashCode() in AliasToBeanResultTransformerHHH-2510Resolved issue: HHH-2510Former user
- criteria-api: filtering by key-many-to-one causes invalid sqlHHH-1570Resolved issue: HHH-1570Steve Ebersole
- HQL parser does not resolve alias in ORDER BY clauseHHH-892Resolved issue: HHH-892Former user
JoinColumn on non key field fails to populate collection
Details
Assignee
Steve EbersoleSteve EbersoleReporter
Christopher SamsChristopher Sams(Deactivated)Time tracking
6.12h loggedComponents
Fix versions
Priority
Major
Details
Details
Assignee
Reporter
Time tracking
Components
Fix versions
Priority
Activity
Brett MeyerMarch 7, 2014 at 10:08 PM
Bulk closing tickets resolved in released versions
Strong LiuJuly 25, 2012 at 3:41 AM
you commited this to the master branch, which i think it should be ported to 4.1 branch as well
Strong LiuJuly 23, 2012 at 6:12 PM
org.hibernate.type.CollectionType#getKeyOfOwner returns entity instance as collection key instead of composite pk instance, which is expected
Strong LiuJuly 23, 2012 at 6:09 PM
I have some analysis on this issue:
when initialising an EntityKey (with this constructor public EntityKey(Serializable id, EntityPersister persister, EntityMode entityMode)), somehow, the serializable id instance is actually the Entity (with embedded id) instance itself, and identifierType get by `this.identifierType = persister.getIdentifierType();` is correct – the embedded id type.
the method org.hibernate.engine.EntityKey#generateHashCode is called during initialising time, and it then calls `identifierType.getHashCode( identifier, entityMode, factory )`
since identifierType is actually ComponentType, so, in the method getHashCode, this class will using getters to get each filed values from identifier, then there is a type mismatch happens, the identifier type here is supposed to be the embedded pk instance, which it is actually the entity class instance.
so, the https://gist.github.com/3164408 exception throws
To duplicate the issue, create three tables in a database with no declared primary or foreign keys. Map entities to two of the tables. One of these entities has a primitive @Id; the other has an @EmbeddedId. Both entities contain an additional field used to join with the third table and populate a collection.
This works with the entity that has a primitive @Id but for the entity with @EmbeddedId, trying to do anything with the collection after calling the getter results in:
javax.ejb.EJBException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of jboss.example.DoesNotWorkPk.id1
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77)
....
Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of jboss.example.DoesNotWorkPk.id1
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:58)
....
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String field jboss.example.DoesNotWorkPk.id1 to jboss.example.DoesNotWork
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
I've attached a sample project. The relevant files are Works.java, DoesNotWork.java, and DoesNotWorkPk.java
There's also data.sql along with the java files to populate a mysql db, but I think any DB will do.