[Hibernate-JIRA] Commented: (HHH-1287) Problem with WAS ExtendedJTATransaction not available when using MDB
by Purvin Patel (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1287?page=c... ]
Purvin Patel commented on HHH-1287:
-----------------------------------
Whats the final resolution to this issue?
> Problem with WAS ExtendedJTATransaction not available when using MDB
> --------------------------------------------------------------------
>
> Key: HHH-1287
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1287
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1
> Environment: WAS 6.0.2
> Message Driven Bean (CMT)
> Websphere MQ 5.3
> Oracle 10g (thin XA driver)
> Reporter: dave jackson
> Assignee: Steve Ebersole
> Fix For: 3.2.0.alpha1, 3.1.3
>
>
> I'm currently having problems with the WAS6 ExtendedJTATransaction when using an MDB to update the database. The problem does not occur when using CMT SSBs.
> It looks like the ExtendedJTATransaction is simply not available after the CMT completes and the WebSphereExtendedJTATransactionLookup class attempts to look it up at java:comp/websphere/ExtendedJTATransaction as part of the normal 'after completion' callback.
> The problem occurs when the afterCompletion callback event fires and the ConnectionManager.isAggressiveRelease() method is called from ConnectionManager.afterTransaction(). This attempts to check to see if a transaction is in progress. This test in fact causes the transaction manager to be created (together with a look up of the current transaction) The lookup of the ExtendedJTATransaction fails and the an exception is thrown (see stack trace below).
> Although there may be an inconsistency in the way that a SSB and MDB operate, It seems fair to say that the transaction may not be available if it has completed. A workaround is therefore requested.
> Stack trace:
> [15/12/05 11:07:49:303 GMT] 0000003f RegisteredSyn E WTRN0074E: Exception caught from after_completion synchronization operation: org.hibernate.HibernateException: javax.naming.NameNotFoundException: Name comp/websphere not found in context "java:".
> at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter.<init>(WebSphereExtendedJTATransactionLookup.java:235)
> at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter.<init>(WebSphereExtendedJTATransactionLookup.java:215)
> at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.getTransaction(WebSphereExtendedJTATransactionLookup.java:163)
> at org.hibernate.util.JTAHelper.isTransactionInProgress(JTAHelper.java:36)
> at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:180)
> at org.hibernate.jdbc.ConnectionManager.isAggressiveRelease(ConnectionManager.java:142)
> at org.hibernate.jdbc.ConnectionManager.afterTransaction(ConnectionManager.java:189)
> at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:213)
> at org.hibernate.transaction.CacheSynchronization.afterCompletion(CacheSynchronization.java:85)
> at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$1.invoke(WebSphereExtendedJTATransactionLookup.java:265)
> at $Proxy30.afterCompletion(Unknown Source)
> at com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.afterCompletion(SynchronizationCallbackWrapper.java:74)
> at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeAfter(RegisteredSyncs.java(Compiled Code))
> at com.ibm.ws.Transaction.JTA.TransactionImpl.distributeAfter(TransactionImpl.java:3652)
> at com.ibm.ws.Transaction.JTA.TransactionImpl.postCompletion(TransactionImpl.java:3631)
> at com.ibm.ws.Transaction.JTA.TransactionImpl.internalCommit(TransactionImpl.java:2522)
> at com.ibm.ws.Transaction.JTA.TransactionImpl.stage2CommitProcessing(TransactionImpl.java:1609)
> at com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(TransactionImpl.java:1483)
> at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(TransactionImpl.java:1414)
> at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(TranManagerImpl.java:236)
> at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(TranManagerSet.java:157)
> at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:716)
> at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:167)
> at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:569)
> at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java(Compiled Code))
> at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:102)
> at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:127)
> at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:458)
> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1455)
> Caused by: javax.naming.NameNotFoundException: Name comp/websphere not found in context "java:".
> at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java(Compiled Code))
> at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java(Compiled Code))
> at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java(Inlined Compiled Code))
> at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java(Compiled Code))
> at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java(Compiled Code))
> at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java(Compiled Code))
> at javax.naming.InitialContext.lookup(InitialContext.java(Compiled Code))
> at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter.<init>(WebSphereExtendedJTATransactionLookup.java:227)
> ... 28 more
--
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, 9 months
[Hibernate-JIRA] Commented: (HHH-1895) HqlSqlWalker throws NullPointerException with explicit joins and component mapping
by Victor Sergienko (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1895?page=c... ]
Victor Sergienko commented on HHH-1895:
---------------------------------------
Same problem here.
Excuse me, but isn't "join" supposed to word according to
http://docs.jboss.org/hibernate/stable/core/reference/en/html/queryhql.ht...
?
Thank you.
> HqlSqlWalker throws NullPointerException with explicit joins and component mapping
> ----------------------------------------------------------------------------------
>
> Key: HHH-1895
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1895
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.1.3
> Environment: Oracle 9i, Hibernate 3.1.3
> Reporter: Victor Suarez
> Priority: Minor
>
> HqlSqlWalker throws a NPE if a explicit join is used with fields that are mapped with component mapping. If explicit join is removed and implicit join is used, the HQL works fine. This kind of problem didn't occur with Hibernate2.
> Examples (hbm below):
> The query:
> String query = "FROM " + Pais.class.getName() + " AS pais JOIN pais.metaInfo AS minfo WHERE minfo.activo = true";
> fails with this stacktrace:
> Exception in thread "main" java.lang.NullPointerException
> at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:317)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3268)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3060)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
> at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
> at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
> at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583)
> This one works fine:
> String query = "FROM " + Pais.class.getName() + " AS pais WHERE pais.metaInfo.activo = true";
> With this behaviour, HQL seems not to be totally transparent to mappings.
> Mapping file:
> <hibernate-mapping>
> <class name="Pais" table="Paises" lazy="true">
> <id name="id" type="long" column="id">
> <generator class="increment"/>
> </id>
> <component name="metaInfo" class="MetaInfo">
> <property name="usuarioAlta" column="usuarioAltaMetaInfo" type="string" not-null="false"/>
> <property name="fechaBaja" column="fechaBajaMetaInfo" type="timestamp" not-null="false"/>
> <property name="fechaAlta" column="fechaAltaMetaInfo" type="timestamp" not-null="false"/>
> <property name="activo" column="activoMetaInfo" type="boolean" not-null="false"/>
> <property name="usuarioBaja" column="usuarioBajaMetaInfo" type="string" not-null="false"/>
> </component>
> <property name="nombre" column="nombre" type="string" not-null="true"/>
> <property name="codigo" column="codigo" type="string" not-null="false"/>
>
> <set name="localidades" access="field" inverse="true"
> cascade="all-delete-orphan" lazy="true" batch-size="5">
> <key column="pais" />
> <one-to-many class="Localidad"/>
> </set>
> <set name="provincias" access="field" inverse="true"
> cascade="all-delete-orphan" lazy="true" batch-size="5">
> <key column="pais" />
> <one-to-many class="Provincia"/>
> </set>
>
> <property name="codAS400" type="string" not-null="false"/>
> </class>
> </hibernate-mapping>
--
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, 9 months
[Hibernate-JIRA] Assigned: (HHH-272) Add the ablity to use sql functions on generated insert/update
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-272?page=co... ]
Steve Ebersole reassigned HHH-272:
----------------------------------
Assignee: Steve Ebersole
> Add the ablity to use sql functions on generated insert/update
> --------------------------------------------------------------
>
> Key: HHH-272
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-272
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate3, Oracle9
> Reporter: Joe Dunne
> Assignee: Steve Ebersole
> Priority: Minor
> Attachments: AbstractCollectionPersister.java, BasicEntityPersister.java, Column.java, HbmBinder.java, hhh-272-hbcore-patch.txt, hibernate-mapping-3.0.dtd, Insert.java, SelectFragment.java, Update.java
>
>
> I would like to have Hibernate generate insert and update statements that contain a stored proc call.
> For example:
> insert into cat (id, name, tag) values ( ?, ? , encrypt(?) )
> Currently I have implemented the following:
> maping file:
> <property name="ssn" type="java.lang.String" access="field">
> <column name="SSN" scale="128" precision="0" not-null="false" sql-type="VARCHAR2" />
> </property>
> <property name="ssnDecrypted" formula="FNC_JAVA_DECRYPT(SSN)" type="java.lang.String" access="field"/>
> <sql-insert>insert into PARTICIPANT (VERSION, DATE_MODIFIED, DATE_CREATED, MODIFIED_BY, CREATED_BY, FIRST_NAME, LAST_NAME, PASSWORD, USERNAME, SSN, EMAIL, ID)
> values (?, ?, ?, ?, ?, ?, ?, ?, ?, FNC_JAVA_ENCRYPT(?), ?, ?)</sql-insert>
> <sql-update>update PARTICIPANT set VERSION=?, DATE_MODIFIED=?, DATE_CREATED=?, MODIFIED_BY=?, CREATED_BY=?, FIRST_NAME=?, LAST_NAME=?,
> PASSWORD=?, USERNAME=?, SSN = FNC_JAVA_ENCRYPT(?), EMAIL=? where ID=? and VERSION=?</sql-update>
> Domain Object:
> public String getSsn() {
> return ssnDecrypted;
> }
> public void setSsn(String ssn) {
> this.ssn = ssn;
> this.ssnDecrypted = ssn;
> }
> This works, but I would like to avoid the <sql-insert> and <sql-update> tags since the project I am on has multiple customer deployments. Each customer can specify what fields they want encrypted. It would be much easier to not have the deployment team write the sql for insert and update for each customer.
> Also, Java encryption is out. We have to do it in the database.
> The EnhancedUserType could support this - perhaps.
> public String getUpdateFragment() {
> return "encrypt(?)";
> }
> public String getInsertFragment() {
> return "encrypt(?)";
> }
> //Is this one possible too? This would avoid the double mapping
> //above and the magic in the domain object
> public String getSelectFragment(String columnName) {
> return "decrypt("+columnName+")";
> }
--
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, 9 months
[Hibernate-JIRA] Updated: (HHH-272) Add the ablity to use sql functions on generated insert/update
by Rob Hasselbaum (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-272?page=co... ]
Rob Hasselbaum updated HHH-272:
-------------------------------
Attachment: hhh-272-hbcore-patch.txt
I am attaching an updated patch and unit tests for this based on the code in 3.3.2.GA. This patch covers more cases than Stuart's original proposal and fixes some issues. It handles entity CRUD operations (of course), projections, predicates, order by, group by having, components, composite elements, user types, and any other case I could identify. To use it, change your property mapping like so:
<property name="creditCardNumber">
<column name="credit_card_num" sql-set="encrypt(?)" sql-get="decrypt(credit_card_num)"/>
</property>
You can use any valid SQL expression--not just functions. Essentially, it works just like a formula property with two differences:
(1) The data is backed by a real column, which is exported with the schema.
(2) The data is read-write, not read-only.
There are just a couple of caveats:
(1) It works for property columns only. I made no attempt to handle id, key, index, or other kinds of non-property columns, which would involve more pervasive changes.
(2) The sql-set expression must contain exactly one placeholder ('?') character. This is enforced in the mapping validation. (Sorry Martin. I think you could use a generated property instead, though.)
I am interested in feedback, particularly if there's a case I missed or bugs. ;-) I also have a patch nearly ready to expose this functionality in hibernate-annotations in case the core patch is accepted.
> Add the ablity to use sql functions on generated insert/update
> --------------------------------------------------------------
>
> Key: HHH-272
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-272
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate3, Oracle9
> Reporter: Joe Dunne
> Priority: Minor
> Attachments: AbstractCollectionPersister.java, BasicEntityPersister.java, Column.java, HbmBinder.java, hhh-272-hbcore-patch.txt, hibernate-mapping-3.0.dtd, Insert.java, SelectFragment.java, Update.java
>
>
> I would like to have Hibernate generate insert and update statements that contain a stored proc call.
> For example:
> insert into cat (id, name, tag) values ( ?, ? , encrypt(?) )
> Currently I have implemented the following:
> maping file:
> <property name="ssn" type="java.lang.String" access="field">
> <column name="SSN" scale="128" precision="0" not-null="false" sql-type="VARCHAR2" />
> </property>
> <property name="ssnDecrypted" formula="FNC_JAVA_DECRYPT(SSN)" type="java.lang.String" access="field"/>
> <sql-insert>insert into PARTICIPANT (VERSION, DATE_MODIFIED, DATE_CREATED, MODIFIED_BY, CREATED_BY, FIRST_NAME, LAST_NAME, PASSWORD, USERNAME, SSN, EMAIL, ID)
> values (?, ?, ?, ?, ?, ?, ?, ?, ?, FNC_JAVA_ENCRYPT(?), ?, ?)</sql-insert>
> <sql-update>update PARTICIPANT set VERSION=?, DATE_MODIFIED=?, DATE_CREATED=?, MODIFIED_BY=?, CREATED_BY=?, FIRST_NAME=?, LAST_NAME=?,
> PASSWORD=?, USERNAME=?, SSN = FNC_JAVA_ENCRYPT(?), EMAIL=? where ID=? and VERSION=?</sql-update>
> Domain Object:
> public String getSsn() {
> return ssnDecrypted;
> }
> public void setSsn(String ssn) {
> this.ssn = ssn;
> this.ssnDecrypted = ssn;
> }
> This works, but I would like to avoid the <sql-insert> and <sql-update> tags since the project I am on has multiple customer deployments. Each customer can specify what fields they want encrypted. It would be much easier to not have the deployment team write the sql for insert and update for each customer.
> Also, Java encryption is out. We have to do it in the database.
> The EnhancedUserType could support this - perhaps.
> public String getUpdateFragment() {
> return "encrypt(?)";
> }
> public String getInsertFragment() {
> return "encrypt(?)";
> }
> //Is this one possible too? This would avoid the double mapping
> //above and the magic in the domain object
> public String getSelectFragment(String columnName) {
> return "decrypt("+columnName+")";
> }
--
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, 9 months
[Hibernate-JIRA] Created: (HHH-4080) Distributed QueryCache does not evict
by andreas bester (JIRA)
Distributed QueryCache does not evict
--------------------------------------
Key: HHH-4080
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4080
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.3.2, 3.3.1
Environment: Hibernate 3.3.1/2 + ehcache1.5& 1.6, multiple Tomcats
Reporter: andreas bester
This is essentially the exact same issue described in http://opensource.atlassian.com/projects/hibernate/browse/HHH-3734
further to this : https://forum.hibernate.org/viewtopic.php?t=979125&highlight=querycache
Except It's a bug and not really an enhancement as it stops you from using Distributed QueryCache when using Invalidation.
I am more than willing to test any patches. or provide more information.
Details:
-App1 (user facing website)
-App2 (cms)
1. App1 calls: StandardQueryCache.cacheRegion.put() placing an HQL query in cache referencing table "A"
2. App2 makes an update to the entity representing table "A"
3. EHCache on App2 broadcasts an "UPDATE" message to update the UpdateTimestampsCache for table "A"
4. App1 receives the "UPDATE" message from App2 but ignores it because the UpdateTimestampsCache for App1 does not contain an entry for table "A"
5. App1 holds onto it's originally cached value and does not reflect the update that has taken place
Basically, the user facing application is not receiving CMS updates for HQL queries when distributed. This is because the QueryCache API does not pass the Set of "spaces" and the StandardQueryCache does not populate the UpdateTimestampsCache with an initial entry when an HQL query is cached.
--
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, 9 months
[Hibernate-JIRA] Created: (HHH-4113) Support for case when ... then ... else ... end when using projections
by Dobes Vandermeer (JIRA)
Support for case when ... then ... else ... end when using projections
----------------------------------------------------------------------
Key: HHH-4113
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4113
Project: Hibernate Core
Issue Type: New Feature
Affects Versions: 3.3.2
Reporter: Dobes Vandermeer
Attachments: CaseWhenProjection.java, ConstantProjection.java
I have a colleciton of queries that are mostly the same except for one part of the condition, and I decided to convert them to using the criteria API so I didn't have to copy/paste the entire text of the query all over the place. The only missing features were:
1. Support for case when ... then ... else ... end in the select clauses/projections
2. Support for constants in the projections
So, I added them.
There are a couple hacks in there that could be eliminated if you were willing to change the guts of the criteria system a little bit - particularly to allow projections to add '?' values to the SQL query and to make it easier to tell a projection not to emit as "as" clause. These changes would support other compound projections such as negation, add, subtract, divide. Why not support expressions like "sum(case when x then -y else z end)" ... ?
I thought I'd share these to benefit anyone else out there who might run into the same issue, or to serve as an example to work from if the hibernate contributors are interested in incorporating this into the core.
--
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, 9 months