[Hibernate-JIRA] Created: (HHH-2160) JTATransactionFactory.isTransactionInProgress fails with WebSphereExtendedJTATransactionLookup
by Timothy Folks (JIRA)
JTATransactionFactory.isTransactionInProgress fails with WebSphereExtendedJTATransactionLookup
----------------------------------------------------------------------------------------------
Key: HHH-2160
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2160
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: Hibernate 3.2.0 ga
WebSphere Application Server 6.0.2.15
DB2 9.1
Reporter: Timothy Folks
Configurating Hibernate with the following settings:
hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
jta.UserTransaction=java:comp/UserTransaction
hibernate.current_session_context_class=jta
results in the following stack trace (irrelevant lines snipped)
<snipped>
Caused by: org.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:181)
at org.hibernate.jdbc.JDBCContext.<init>(JDBCContext.java:76)
at org.hibernate.impl.SessionImpl.<init>(SessionImpl.java:213)
at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:525)
at org.hibernate.context.JTASessionContext.buildOrObtainSession(JTASessionContext.java:114)
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:80)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)
<snipped>
Caused by: java.lang.UnsupportedOperationException
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.getStatus(WebSphereExtendedJTATransactionLookup.java:78)
at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:94)
at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:187)
at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:159)
The workaround I've implemented is to change the following line in JTATransactionFactory.isTransactionInProgress:
if ( jdbcContext.getFactory().getTransactionManager() != null ) {
to:
if ( jdbcContext.getFactory().getTransactionManager() != null && jdbcContext.getFactory().getTransactionManager() instanceof WebSphereExtendedJTATransactionLookup.TransactionManagerAdapter == false) {
This results in the method falling back to looking up the UserTransaction in JNDI and calling getStatus on that.
--
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-2698) optimistic-lock="dirty" does not throw StaleObjectException if object modified by another session using detached objects
by Alex McCarrier (JIRA)
optimistic-lock="dirty" does not throw StaleObjectException if object modified by another session using detached objects
------------------------------------------------------------------------------------------------------------------------
Key: HHH-2698
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2698
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.2
Environment: Tomcat 5.5, Hibernate 3.2, Spring 2.0
Reporter: Alex McCarrier
Priority: Minor
We have two clients, a web client and a swing client. With optimistic-lock="dirty" defined for an entity, if two web clients modify the same field on the same entity, it throws StaleObjectException as expected.
We also have a swing client that sends detached entities back and forth. If the detached client modifies and entity at the same time as the web client, no exception is thrown, but the web client fails the update. The reason being is the web client has an extra where clause that includes the modified field, instead of just the primary key. Since the detached client changed the value already, the web client finds nothing to update.
For example, changing description field, web client does something like:
update MyEntity set description = "web description" where id = 1 and description = "old description";
detached client does before web client completes:
update MyEntity where id = 1 set description = "some other description";
web client continues and doesn't find anything to update, because where clause in first query fails.
I would think in this particular scenario, if the web client finds nothing to update, it would throw a StaleObjectStateException.
--
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] Commented: (HHH-1657) hql update generate wrong sql with joined subclass hierarcy
by David (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657?page=c... ]
David commented on HHH-1657:
----------------------------
I have a similar but different bug to report. (If this is different someone place repost.)
The problem is the update SQL comment doesn't use aliases so my inner query ends up referencing the wrong table.
The following EJB QL query...
UPDATE Provider p SET p.avgRating = (SELECT AVG(r.score) FROM Rating r WHERE r.providerFor = p) WHERE p.id = 44;
becomes...
update Provider set avgRating=(select AVG(rating1_.score) from Rating rating1_ where rating1_.providerFor_id=id) where id=44;
This query isn't correct. The 'id' at the end of the where of the inner select does not refer to the id of the Provider as it should, instead the id ends up referencing Rating which obviously isn't what i want.
This EJB QL query really should be generating the following SQL query which uses aliases:
update Provider p set p.avgRating=(select AVG(rating1_.score) from Rating rating1_ where rating1_.providerFor_id=p.id) where p.id=44;
(I don't know a way around this so for the time being I am resorting to using a native query.)
> hql update generate wrong sql with joined subclass hierarcy
> -----------------------------------------------------------
>
> Key: HHH-1657
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
> Project: Hibernate3
> Issue Type: Bug
> Components: query-hql
> Environment: Hibernate 3.2.0cr1, Hibernate 3.1.3
> Reporter: Alexey Romanchuk
> Priority: Critical
>
> Let suppose that we have two joined subclass entities: Parent (id PK) and Child (id PK) that mapped with joined subclass method.
> When I try to update Child by id with hql:
> update Child c set c.field = 'value' where c.id = 1234
> hibernate generates joined tables like
> insert into HT_parent select child0_.id as id from child child0_ inner join parent child0_1_ on child0_.id=child0_1_.id wher id in = 1234
> look at last condition. hibernate use id WITH OUT tables alias that cause sql exception: column reference "id" is ambiguous
--
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, 6 months
[Hibernate-JIRA] Deleted: (ANN-629) Eager ManyToOne relationship does not work using annotations
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-629?page=co... ]
Emmanuel Bernard deleted ANN-629:
---------------------------------
> Eager ManyToOne relationship does not work using annotations
> ------------------------------------------------------------
>
> Key: ANN-629
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-629
> Project: Hibernate Annotations
> Issue Type: Bug
> Environment: Oracle 10g environment.
> Reporter: George Gastaldi
>
> The FetchMode.JOIN is not working for ManyToOne relationships.
> Using:
> session.createQuery("from OrigemVO obj").list();
> produces:
> Hibernate:
> select
> origemvo0_.CD_ORIGEM as CD1_1_,
> origemvo0_.VERSAO as VERSAO1_,
> origemvo0_.DT_ALTERACAO as DT3_1_,
> origemvo0_.NM_USUARIO as NM4_1_,
> origemvo0_.DS_ORIGEM as DS5_1_,
> origemvo0_.SG_UF as SG6_1_,
> origemvo0_.CD_JURISDICAO as CD9_1_,
> origemvo0_.COD_TST as COD7_1_,
> origemvo0_.COD_IBGE as COD8_1_
> from
> JCOMPANY.ORIGENS origemvo0_
> where
> origemvo0_.CD_ORIGEM=304
> Hibernate:
> select
> jurisdicao0_.CD_JURISDICAO as CD1_0_0_,
> jurisdicao0_.DS_JURISDICAO as DS2_0_0_
> from
> JCOMPANY.JURISDICAO jurisdicao0_
> where
> jurisdicao0_.CD_JURISDICAO=?
> whether It should be:
> select
> this_.CD_ORIGEM as CD1_1_1_,
> this_.VERSAO as VERSAO1_1_,
> this_.DT_ALTERACAO as DT3_1_1_,
> this_.NM_USUARIO as NM4_1_1_,
> this_.DS_ORIGEM as DS5_1_1_,
> this_.SG_UF as SG6_1_1_,
> this_.CD_JURISDICAO as CD9_1_1_,
> this_.COD_TST as COD7_1_1_,
> this_.COD_IBGE as COD8_1_1_,
> jurisdicao2_.CD_JURISDICAO as CD1_0_0_,
> jurisdicao2_.DS_JURISDICAO as DS2_0_0_
> from
> JCOMPANY.ORIGENS this_
> inner join
> JCOMPANY.JURISDICAO jurisdicao2_
> on this_.CD_JURISDICAO=jurisdicao2_.CD_JURISDICAO
> Classes and hibernate.cfg.xml attached.
> It works when using:
> session.createCriteria(OrigemVO.class).list();
--
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, 6 months
[Hibernate-JIRA] Deleted: (ANN-628) Eager ManyToOne relationship does not work using annotations
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-628?page=co... ]
Emmanuel Bernard deleted ANN-628:
---------------------------------
> Eager ManyToOne relationship does not work using annotations
> ------------------------------------------------------------
>
> Key: ANN-628
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-628
> Project: Hibernate Annotations
> Issue Type: Bug
> Environment: Oracle 10g environment.
> Reporter: George Gastaldi
>
> The FetchMode.JOIN is not working for ManyToOne relationships.
> Using:
> session.createQuery("from OrigemVO obj").list();
> produces:
> Hibernate:
> select
> origemvo0_.CD_ORIGEM as CD1_1_,
> origemvo0_.VERSAO as VERSAO1_,
> origemvo0_.DT_ALTERACAO as DT3_1_,
> origemvo0_.NM_USUARIO as NM4_1_,
> origemvo0_.DS_ORIGEM as DS5_1_,
> origemvo0_.SG_UF as SG6_1_,
> origemvo0_.CD_JURISDICAO as CD9_1_,
> origemvo0_.COD_TST as COD7_1_,
> origemvo0_.COD_IBGE as COD8_1_
> from
> JCOMPANY.ORIGENS origemvo0_
> where
> origemvo0_.CD_ORIGEM=304
> Hibernate:
> select
> jurisdicao0_.CD_JURISDICAO as CD1_0_0_,
> jurisdicao0_.DS_JURISDICAO as DS2_0_0_
> from
> JCOMPANY.JURISDICAO jurisdicao0_
> where
> jurisdicao0_.CD_JURISDICAO=?
> whether It should be:
> select
> this_.CD_ORIGEM as CD1_1_1_,
> this_.VERSAO as VERSAO1_1_,
> this_.DT_ALTERACAO as DT3_1_1_,
> this_.NM_USUARIO as NM4_1_1_,
> this_.DS_ORIGEM as DS5_1_1_,
> this_.SG_UF as SG6_1_1_,
> this_.CD_JURISDICAO as CD9_1_1_,
> this_.COD_TST as COD7_1_1_,
> this_.COD_IBGE as COD8_1_1_,
> jurisdicao2_.CD_JURISDICAO as CD1_0_0_,
> jurisdicao2_.DS_JURISDICAO as DS2_0_0_
> from
> JCOMPANY.ORIGENS this_
> inner join
> JCOMPANY.JURISDICAO jurisdicao2_
> on this_.CD_JURISDICAO=jurisdicao2_.CD_JURISDICAO
> Classes and hibernate.cfg.xml attached.
> It works when using:
> session.createCriteria(OrigemVO.class).list();
--
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, 6 months