[Hibernate-JIRA] Created: (HHH-7305) NPE in LogicalConnectionImpl when multi tenancy is used without providing a release mode manually
by Christian kalkhoff (JIRA)
NPE in LogicalConnectionImpl when multi tenancy is used without providing a release mode manually
-------------------------------------------------------------------------------------------------
Key: HHH-7305
URL: https://hibernate.onjira.com/browse/HHH-7305
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.3
Environment: cfg.setProperty(Environment.MULTI_TENANT, MultiTenancyStrategy.DATABASE.name());
Reporter: Christian kalkhoff
Priority: Critical
When multi tenancy is used and hibernate.connection.release_mode is not set, one gets a NPE in LogicalConnectionImpl because it accesses a (non-multi-tenancy)connection provider to determine the release mode.
Stack trace:
java.lang.NullPointerException
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.determineConnectionReleaseMode(LogicalConnectionImpl.java:119)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.<init>(LogicalConnectionImpl.java:100)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.<init>(LogicalConnectionImpl.java:82)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.<init>(JdbcCoordinatorImpl.java:75)
at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.<init>(TransactionCoordinatorImpl.java:87)
at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:249)
at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1835)
...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-6608) @JoinColumns doesn't work inside an @Embedded member
by Joeri Hendrickx (JIRA)
@JoinColumns doesn't work inside an @Embedded member
----------------------------------------------------
Key: HHH-6608
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6608
Project: Hibernate Core
Issue Type: Bug
Components: annotations, metamodel
Affects Versions: 4.0.0.CR1, 3.5.6
Environment: Version 3.5.6 and up, no DB
Reporter: Joeri Hendrickx
Attachments: hibernate-embedded-joincolumns.zip
If you use multiple joincolumns on a @ManyToOne or @OneToOne field in an @Embedded class, hibernate will fail when building its metamodel with the following exception:
Exception in thread "main" org.hibernate.MappingException: property [_model_MainEntity_embeddedEntity.referencedEntity] not found on entity [model.ReferencedEntity]
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:379)
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:406)
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:111)
at org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:541)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:523)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:380)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at model.Test.main(Test.java:12)
Caused by: org.hibernate.MappingException: property [_model_MainEntity_embeddedEntity.referencedEntity] not found on entity [model.ReferencedEntity]
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:425)
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:376)
... 8 more
A test case is included. Just run model. Test with the hibernate libraries in the classpath.
I get the impression this is because of the dot in the generated property name. Hibernate generates a synthetic property, named after the FQN of the owning entity (with dots replaces by underscores) appended by and underscore and the name of the property. But properties inside of embedded objects are represented with a dot; when Hibernate later tries to retrieve the same property, it incorrectly interprets this dot as a delimiter, and will look for `_model_MainEntity_embeddedEntity` (in the example above) instead; which it will not find.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-7108) @TypeDef doesn't work for enums
by Michael Nascimento Santos (JIRA)
@TypeDef doesn't work for enums
-------------------------------
Key: HHH-7108
URL: https://hibernate.onjira.com/browse/HHH-7108
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.0
Environment: hibernate-jpa-2.0-api:1.0.1-Final; hibernate-core:4.1.0.Final; hibernate-entitymanager:4.1.0.Final
Reporter: Michael Nascimento Santos
Priority: Critical
@TypeDef is supposed to allow users to define standard types to be used for specific classes. However, due to a bug in implementation, it simply doesn't work for enums.
Enums are implicitly handled by the JPA spec. However, if a @TypeDef is defined for a particular enum, it will never be picked up due to bug in org.hibernate.cfg.annotations.SimpleValueBinder .
This class has a concept of a "explicitType", i.e., a type that was explicitly specified for a property. However, even if @EnumType is not used to annotate a property, method setType(XProperty,XClass) considers the property as annotated with it. Then, when fillSimpleValue() is called as part of second-pass compilation, the ternary in line 344 chooses org.hibernate.type.EnumType instead of the enum FQN, causing any @TypeDef to be ignored.
This behaviour should be fixed by considering a non-annotated enum property as implicitly typed, not explicitly. Then, the resolution order should be changed to explicitType -> returnedClassName -> implicitType. This would preserve default, expected behaviour for regular enums, while allowing @TypeDef to be used for enums as well.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months