[Hibernate-JIRA] Created: (HHH-3853) one-to-one mapping doesn support Primary Key Association
by Amar Singh (JIRA)
one-to-one mapping doesn support Primary Key Association
--------------------------------------------------------
Key: HHH-3853
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3853
Project: Hibernate Core
Issue Type: Bug
Components: envers
Environment: Hibernate - core 3.4.0-SNAPSHOT, Hibernate - envers (trunk build from today)
Reporter: Amar Singh
Attachments: one-to-one-pk.zip
one-to-one mapping with primary key association doesn't seem to be working. Eg.
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.hibernate.envers.test.integration.onetoone.bidirectional" default-lazy="false">
<class name="BidirectionalRefIngPK" table="BIDIRECTIONAL_REFERENCING_ENTITY">
<id name="id" type="long" column="BIDIRECTIONAL_REFERENCING_ID" >
<generator class="foreign">
<param name="property">reference</param>
</generator>
</id>
<property name="data"/>
<property column="BIDIRECTIONAL_REFERENCING_ID" generated="never" insert="false" lazy="false" name="id" type="long" update="false"/>
<one-to-one name="reference" cascade="save-update" class="BidirectionalRefEdPK" constrained="true" />
</class>
<class name="BidirectionalRefEdPK" table="BIDIRECTIONAL_REFERENCED_ENTITY">
<id name="longId" type="long" column="BIDIRECTIONAL_REFERENCED_ID">
<generator class="native"/>
</id>
<property name="data"/>
<one-to-one name="referencing" cascade="all" class="BidirectionalRefIngPK" />
</class>
</hibernate-mapping>
When we try to load a BidirectionalRefIngPK, the underlying query invokes RelatedAuditExpression and since its not a foreign-key based one-to-one association the loading fails in method addToQuery of RelatedAuditExpression at line 52 (relatedEntity==null) with the following exception:
Code:
"This criterion can only be used on a property that is a relation to another property."
TO REPRODUCE
~~~~~~~~~~~~~
Please find a zip file attached which has four files:
- BidirectionalPrimaryAssociation.java (actual testng test case)
- BidirectionalRefEdPK.java (Entity 1)
- BidirectionalRefIngPK.java (Entity 2)
- mappings.hbm.xml
Please put the three java files in its package (org.hibernate.envers.test.integration.onetoone.bidirectional) and the mapping file in src/test/resources.
Now when you run envers tests you should see the failure.
Thanks for this great component !
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6689) DefaultMergeEventListener changes CheckNullability flag - not thread save
by John SMith (JIRA)
DefaultMergeEventListener changes CheckNullability flag - not thread save
-------------------------------------------------------------------------
Key: HHH-6689
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6689
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.5
Environment: Websphere Application Server 7.0, DB2, Windows Server, Hibernate 3.6.5
Reporter: John SMith
saveTransientEntity() method saves the CheckNullability setting, changes it using the getFactory().getSettings().setCheckNullability method, and does save processing. After save processing, the saved value is restored.
During load testing, we have had situations where the CheckNullability becomes set to TRUE and causes failures because of null checks.
It has been difficult to debug, but it appears that this is not thread safe - multiple threads accessing this method can change the value of this setting.
It can also be that a database error can cause an exception that will cause the checkNullability flan not to be reset.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6957) Throw PropertyValueException if there are unresolved entity insert actions after persist/save/merge listeners execute
by Gail Badner (JIRA)
Throw PropertyValueException if there are unresolved entity insert actions after persist/save/merge listeners execute
---------------------------------------------------------------------------------------------------------------------
Key: HHH-6957
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6957
Project: Hibernate Core
Issue Type: Improvement
Components: core
Reporter: Gail Badner
Assignee: Gail Badner
Fix For: 4.1.0
The current behavior (before this proposed change) is kind of complicated when an entity has a non-nullable, transient reference that is not resolved by cascading.
When CHECK_NULLABILITY is true:
- persist/save/merge event listeners will throw PropertyValueException;
When CHECK_NULLABILITY is false:
- if the entity insert action is executed before the session is flushed (i.e., an "early" insert to generate an identity ID), then JDBCException is thrown;
- otherwise, TransientObjectException is thrown when the owning entity is dirty-checked.
The proposed change would make the behavior consistent for all of these cases. If there are any "unresolved" non-nullable, transient entities after the top-level persist/save/merge event executes, then TransientObjectException would be thrown, regardless of the CHECK_NULLABILITY setting.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6965) Avoid throwing an NPE when Infinispan 2LC custom commands are not found
by Galder Zamarreno (JIRA)
Avoid throwing an NPE when Infinispan 2LC custom commands are not found
-----------------------------------------------------------------------
Key: HHH-6965
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6965
Project: Hibernate ORM
Issue Type: Bug
Components: caching (L2)
Affects Versions: 4.0.1
Reporter: Galder Zamarreno
Assignee: Galder Zamarreno
Fix For: 4.1.0
When custom commands for handling evictions are not find, an NPE is thrown from the Infinispan 2LC:
{code}19:35:13,886 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.persistenceunit."jpa_SecondLevelCacheTestCase.jar#ThirdPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."jpa_SecondLevelCacheTestCase.jar#ThirdPU": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_29]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_29]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_29]
Caused by: java.lang.NullPointerException
at org.hibernate.cache.infinispan.InfinispanRegionFactory.getCache(InfinispanRegionFactory.java:445)
at org.hibernate.cache.infinispan.InfinispanRegionFactory.buildEntityRegion(InfinispanRegionFactory.java:198)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:339)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:157)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:81)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]{code}
This JIRA is to clean this up.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-3414) fetch profiles
by Steve Ebersole (JIRA)
fetch profiles
--------------
Key: HHH-3414
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3414
Project: Hibernate3
Issue Type: New Feature
Components: core, metamodel
Reporter: Steve Ebersole
Assignee: Steve Ebersole
Fix For: 3.4
The concept of fetch profiles as we are discussing here is basically to allow users to dynamically affect the mapped fetching strategy for associations at runtime.
Consider the following example:
<class name="Person">
...
<set name="addresses" lazy="true" fetch="subselect" ...>
...
</set>
</class>
<class name="Address">
...
</class>
This follows the normal recommendation to map associations as lazy and use a dynamic fetching strategy (ala HQL/Criteria) to modify this lazy behavior at runtime.
The fetaure discussed here would allow the same behavior for loading as well:
<hibernate-mapping>
<fetch-profile name="person-details">
<fetch path="Person.addresses" style="join"/>
</fetch-profile>
</hibernate-mapping>
Or:
<hibernate-mapping>
<class name="Person">
...
<fetch-profile name="person-details">
<fetch path="addresses" style="join"/>
</fetch-profile>
<set name="addresses" lazy="true" fetch="subselect" ...>
...
</set>
</class>
</hibernate-mapping>
Now, doing:
session.enableFetchProfile( "person-details" ).get( Person.class, 1 )...
will load Person#1 as well as their addresses in a single joined query.
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-5755) javax.persistence.criteria.Expression.as() is broken
by Artem Troitskiy (JIRA)
javax.persistence.criteria.Expression.as() is broken
----------------------------------------------------
Key: HHH-5755
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5755
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.0
Reporter: Artem Troitskiy
Priority: Minor
When I try to execute criteria query containing typecast to {{String}}
{noformat}
CriteriaQuery<Product> criteria = builder.createQuery( Product.class );
Root<Product> from = criteria.from( Product.class );
criteria.where(builder.like(from.get("partNumber").as(String.class), "1%"));
List<Product> result = em.createQuery( criteria ).getResultList();
{noformat}
I get the following exception
{quote}
org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found '(' near line 1, column 132 [select generatedAlias0 from org.hibernate.ejb.metamodel.Product as generatedAlias0 where cast(generatedAlias0.partNumber as varchar(255)) like :param0]
{quote}
As you can see, SQL type is used in HQL {{cast}} clause. It's caused by {{CriteriaQueryCompiler.RenderingContext.getCastType()}} that erroneously return SQL typename instead of Hibernate typename.
--
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
14 years, 2 months