[Hibernate-JIRA] Created: (HHH-2292) Regression between 3.2.0 and 3.2.1. Merge detached instance fails to persist ManyToMany relationship
by Mike Youngstrom (JIRA)
Regression between 3.2.0 and 3.2.1. Merge detached instance fails to persist ManyToMany relationship
-----------------------------------------------------------------------------------------------------
Key: HHH-2292
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2292
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.1
Reporter: Mike Youngstrom
Priority: Critical
I have a ManyToMany relationship. If I attempt to merge a detached instance of the owning side of that relationship the changes to the ManyToMany fail to be persisted. The merge propertly takes place and the persistence context is correctly updated but the SQL commands to update the database are not sent when the session is flushed. I'm using HA 3.2.0 and EM 3.2.0. If I replace the core 3.2.1 jar with 3.2.0 the operation works perfectly. If I attempt the operation on an attached instance the operation works perfectly. it only doesn't work with 3.2.1 with a detached instance. Here are the example entities and example code to duplicate the problem.
--------------Animal.java---------------
@Entity
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@SuppressWarnings("serial")
public class Animal implements Serializable {
@Id @GeneratedValue
private Long id;
private String name;
@ManyToOne
@Basic(fetch=FetchType.LAZY)
private Classification classification;
@ManyToMany
@JoinTable(name="ANIMAL_COUNTRY",
joinColumns=@JoinColumn(name="ANIMAL_ID"),
inverseJoinColumns=@JoinColumn(name="COUNTRY_ID"))
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Basic(fetch=FetchType.LAZY)
private List<Country> countries;
@SuppressWarnings("unused")
@Version
private Long version;
/** SNIP Getters and Setters **/
}
------------Country.java-----------------
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
@SuppressWarnings("serial")
public class Country implements Serializable {
@Id @GeneratedValue @Column(updatable=false)
private Long id; //NOPMD - wheelermm
@Column(unique=true, nullable=false)
public String name;
@Basic(fetch=FetchType.LAZY)
@ManyToMany(mappedBy="countries")
@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
public List<Animal> animals;
}
-----------Example code to duplicate problem----------------
//Start Transaction
Animal animal = entityManager.find(Animal.class, 21l);
animal = (Animal)SerializationUtils.clone(animal); // Detach the animal
List<Country> countries = new ArrayList<Country>();
countries.add(countryService.findAllCountries().get(2));
animal.setCountries(countries);
animal.setClassification(entityManager.find(Classification.class, 1l);
animal.setName("Modified Animal");
entityManager.merge(animal);
//Commit Transaction
When the example code above runs both the animal.name and animal.classification are persisted but the change of country is not persisted. the object returned from entityManger.merge() contains the correct country but the db is never updated. if I comment out the clone() (making it not detached) everything works fine. If I downgrade to 3.2.0 everything works fine.
Mike
Forum post: http://forum.hibernate.org/viewtopic.php?t=968226
--
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
17 years, 5 months
[Hibernate-JIRA] Created: (HHH-2175) L2 Cache performance is very very bad when writing other kinds of objects in the same transaction
by Sami Dalouche (JIRA)
L2 Cache performance is very very bad when writing other kinds of objects in the same transaction
-------------------------------------------------------------------------------------------------
Key: HHH-2175
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2175
Project: Hibernate3
Type: Improvement
Components: core
Versions: 3.2.0.ga
Environment: Hibernate Entity Manager 3.2.0 + Annotations + Core
Reporter: Sami Dalouche
Hibernate L2 Cache performance is very slow when writing objects in the same transaction.
For instance. Let's say we have 2 completly unrelated classes A and B
let's say A never changes, and we write tons of instances of B to the database. Both A and B are managed by the cache, but into differet cache regions (with different Ehcache configurations).
So, let's consider a simple example like :
loop 1:
for(int i = 0 ; i < 10000 ; i++){
new A();
}
and loop2:
for(int i = 0 ; i < 10000 ; i++){
aDao.findAByKey("key");
}
Since the L2 cache + Query cache is activatedon a + findAByKey, loop2's performance is comparable to loop's 1 one. It's pretty much the same, so everything is fine, so far. Let's call X the time taken by loop1 or loop2, that we consider equal.
Now, let's consider loop3 and loop4:
loop 3:
for(int i = 0 ; i < 10000 ; i++){
new A();
bDao.save(new B());
}
and loop4:
for(int i = 0 ; i < 10000 ; i++){
aDao.findAByKey("key");
bDao.save(new B());
}
So, now, let's consider that saving bDao.save(new B()) takes Y seconds for 10,000 iterations.
You would expect loop3 and loop4 to have the same performance, roughly , X + Y, right ?
Well, actually, loop3 takes X + Y.
But loop4 takes around 20 * (X + Y) !!!!!!! (on my machine, so it can be slighly different). But you see the point : there is a HUGE difference of performance.
I am sure there are design reasons for this, that's why I set this bug as an enhancement.. So, 2 things :
* either it is possible to solve this issue, and it would be nice to correct it
* either it is not possible to solve this issue, and it would be nice to add a section in the reference manual, explaining why hibernate behaves that way.
Regards,
Sami Dalouche
--
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
17 years, 5 months
[Hibernate-JIRA] Created: (HHH-2172) Could not determine fecht owner exception with 3.2.0GA (worked in 3.2rc2)
by Alexander Rupsch (JIRA)
Could not determine fecht owner exception with 3.2.0GA (worked in 3.2rc2)
-------------------------------------------------------------------------
Key: HHH-2172
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2172
Project: Hibernate3
Type: Bug
Versions: 3.2.0.ga
Environment: Annotations 3.2.0GA (16.10.06)
Core 3.2.0GA (16.10.06)
Reporter: Alexander Rupsch
HI,
I have a named query like this:
<sql-query name="loadMDGraphJoined-AllPathFromAndToChildSlow">
<return-join alias="parent" property="goe.parent"/>
<return-join alias="child" property="goe.child"/>
<return alias="goe" class="com.ecg.mts.tsm.impl.domain.MasterDataEdge"/>
<![CDATA[
select
pa.id AS {parent.id},
pa.periodstart AS {parent.validPeriod.start},
pa.periodend AS {parent.validPeriod.end},
pa.shortdesc AS {parent.shortDesc},
pa.longdesc AS {parent.longDesc},
pa.name AS {parent.name},
pa.class AS {parent.class},
pa.clientid AS {parent.clientId},
ch.id AS {child.id},
ch.periodstart AS {child.validPeriod.start},
ch.periodend AS {child.validPeriod.end},
ch.shortdesc AS {child.shortDesc},
ch.longdesc AS {child.longDesc},
ch.name AS {child.name},
ch.class AS {child.class},
ch.clientid AS {child.clientId},
goe.parent_id AS {goe.parent},
goe.child_id AS {goe.child},
goe.id AS {goe.id}
from tsm_master_data pa, tsm_master_data ch,
(select DISTINCT ROWID, goe.* from tsm_master_data_edge goe
start with parent_id in (
( /* Selection der Pfade nach "oben" */
SELECT DISTINCT goe2.parent_id
FROM tsm_master_data_edge goe2
START WITH goe2.child_id = :parentId
OR goe2.child_id IN ((SELECT DISTINCT child_id
FROM tsm_master_data_edge
START WITH parent_id = :parentId
CONNECT BY PRIOR parent_id = child_id))
CONNECT BY PRIOR goe2.parent_id = goe2.child_id
)
) or parent_id = :parentId
connect by prior goe.child_id = goe.parent_id) goe
where pa.id = goe.parent_id
and ch.id = goe.child_id
]]>
</sql-query>
And I call it like this (using spring):
List items = getHibernateTemplate().findByNamedQueryAndNamedParam(
"loadMDGraphJoined-AllPathFromAndToChildSlow", "parentId", id);
This works fine with Core 3.2.0rc2 and annotations 3.2.0rc1. After switching to 3.2.0GA I got the following exception:
org.springframework.orm.hibernate3.HibernateSystemException: Could not determine fetch owner : null; nested exception is org.hibernate.HibernateException: Could not determine fetch owner : null
org.hibernate.HibernateException: Could not determine fetch owner : null
at org.hibernate.loader.custom.CustomLoader.determineAppropriateOwnerPersister(CustomLoader.java:250)
at org.hibernate.loader.custom.CustomLoader.<init>(CustomLoader.java:150)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1688)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
at org.springframework.orm.hibernate3.HibernateTemplate$35.doInHibernate(HibernateTemplate.java:947)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:938)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:928)
at com.ecg.mts.tsm.impl.persistence.HibernateMasterDataRepository.getMasterDataGraphComplete(HibernateMasterDataRepository.java:116)
at com.ecg.mts.tsm.test.persistence.MasterDataRepositoryTestBase.testGetMasterDataGraphComplete(MasterDataRepositoryTestBase.java:201)
at com.ecg.mts.tsm.test.persistence.hibernate.HibernateMasterDataRepositoryTest.testGetMasterDataGraphComplete(HibernateMasterDataRepositoryTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
The variable "entityName" in CustomerLoader.determineAppropriateOwnerPersister() ist null because the parameter ownerDescriptor ist null. This is because EntityFetchReturn.getOwner also returns null at line 146.
--
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
17 years, 5 months
[Hibernate-JIRA] Created: (HHH-1979) Unable to locate current JTA transaction
by Kuldeep Singh Virdi (JIRA)
Unable to locate current JTA transaction
----------------------------------------
Key: HHH-1979
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1979
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1
Environment: Hibernat 3.1, My-SQL 5.0, JBOss
Reporter: Kuldeep Singh Virdi
Hi,
I have made a hibernate-service.xml file and deployed it under myApplication.har file
The xml file contents are
<?xml version="1.0"?>
<server>
<mbean code="org.hibernate.jmx.HibernateService"
name="jboss.jca:service=HibernateFactory,name=HibernateFactory">
<!-- Required services -->
<depends>jboss.jca:service=RARDeployer</depends>
<!-- Bind the Hibernate service to JNDI -->
<attribute name="JndiName">java:/hibernate/SessionFactory</attribute>
<!-- Datasource settings -->
<attribute name="Datasource">java:/jdbc/mysqlserverr</attribute>
<attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
<!-- Transaction integration -->
<attribute name="TransactionStrategy">
org.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">
org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="FlushBeforeCompletionEnabled">true</attribute>
<attribute name="AutoCloseSessionEnabled">true</attribute>
<!-- Fetching options -->
<attribute name="MaximumFetchDepth">5</attribute>
<!-- Second-level caching -->
<attribute name="SecondLevelCacheEnabled">true</attribute>
<attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
<attribute name="QueryCacheEnabled">true</attribute>
<!-- Logging -->
<attribute name="ShowSqlEnabled">true</attribute>
</mbean>
</server>
Through my Stateless Session EJB i call a method
private Session getSession() {
if (sessionFactory == null)
sessionFactory = // by look up
}
return sessionFactory.getCurrentSession();
}
I get following excpetion
09:29:14,304 INFO [STDOUT] org.hibernate.HibernateException: Unable to locate current JTA transaction
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:604)
at com.daffodilwoods.framework.datasource.ResourceManager.currentSession(ResourceManager.java:234)
at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getHibernateSession(DataObjectMetaD
at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getDefaultColumns(DataObjectMetaDat
at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getObject(DataObjectMetaDataLoader.
at com.daffodilwoods.framework.core.view.server.metadataloader.AbsTableMetaDataUtil.loadMetadata(AbsTableMetaDataU
at com.daffodilwoods.framework.table.server.TableMetaDataLoader.getObject(TableMetaDataLoader.java:87)
at com.daffodilwoods.framework.table.server.TableService.createView(TableService.java:32)
at com.daffodilwoods.framework.core.view.server.service.AbsViewService.init(AbsViewService.java:41)
at com.daffodilwoods.framework.core.view.server.service.AbsViewService.getViewMetaDataHandler(AbsViewService.java:
at com.daffodilwoods.framework.table.server.TableService.getData(TableService.java:56)
at com.daffodilwoods.framework.core.view.server.service.AbsViewService.getData(AbsViewService.java:68)
at com.daffodilwoods.framework.core.view.server.service.ViewService.getData(ViewService.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:299)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
09:29:14,304 INFO [STDOUT] org.hibernate.HibernateException: Unable to locate current JTA transaction
Can u tell me wht can i do for it.
I think there is not support for providing currentSessionContext attribute in this xml file also
Please reply
--
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
17 years, 5 months
[Hibernate-JIRA] Created: (HHH-2284) HQL: selecting components inside components doesn't work
by Fabio Tudone (JIRA)
HQL: selecting components inside components doesn't work
--------------------------------------------------------
Key: HHH-2284
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2284
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.1.2
Environment: Probably all. Tested with DB2, MySQL, HSQL + Tomcat, WAS5, DriverManager.
Reporter: Fabio Tudone
Priority: Critical
Attachments: test.jar
When using an entity with a component owning another component, as follows:
<class name="org.test.hibernate.bug2455.MyEntity">
<composite-id>
<key-property name="myKey">
<column name="myKey"/>
</key-property>
</composite-id>
<component name="myComponent">
<property name="myValue">
<column name="myValue"/>
</property>
<component name="myInnerComponent">
<property name="myInnerValue">
<column name="myInnerValue"/>
</property>
</component>
</component>
</class>
The following HQL query fails:
"select e.myComponent.myInnerComponent from org.test.hibernate.bug2455.MyEntity e"
with the following error:
could not resolve property: myInnerComponent of: org.test.hibernate.bug2455.MyEntity
--
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
17 years, 5 months