[EJB 3.0] - Re: RC9 mappedBy and InheritanceType.JOINED problem
by NigelWhite
I hit this bug as soon as I upgraded to 3.2
| Caused by: java.lang.NullPointerException
| at org.hibernate.hql.ast.tree.FromClause.findIntendedAliasedFromElementBasedOnCrazyJPARequirements(FromClause.java:120)
| at org.hibernate.hql.ast.tree.FromClause.containsClassAlias(FromClause.java:247)
| at org.hibernate.hql.ast.tree.FromClause.isFromElementAlias(FromClause.java:135)
| at org.hibernate.hql.ast.HqlSqlWalker.isNonQualifiedPropertyRef(HqlSqlWalker.java:467)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4382)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1212)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2299)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:1963)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1825)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1394)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:553)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
| at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
|
This query started failing with NPE:
| select _this.name, _this.language.name,
| cast (_this.dateOrder as integer)
| from Country _this
| left outer join _this.language
|
When I took out the cast, it worked, but that's not what I need.
| select _this.name, _this.language.name,
| _this.dateOrder
| from Country _this
| left outer join _this.language
|
But if I gave the joined association an alias, it worked again:
| select _this.name, l.name,
| cast (_this.dateOrder as integer)
| from Country _this
| left outer join _this.language l
|
It should be reproducible on your in-house test cases:
| select _this.name, _this.mate.name,
| cast(_this.weight as integer)
| from cat _this
| left outer join _this.mate
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053863#4053863
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053863
18Â years, 11Â months
[Messaging, JMS & JBossMQ] - DLQ and caught exception in onMessage
by torsty
Hi, I have the following problem: I have a MDB (EJB 3.0 on AS: 4.0.5.GA) that consumes messages from a queue. In the onMessage method I am calling the method of a Stateless Session Bean (injected with SEAM-mechanism).
| public void onMessage( Message msg )
| {
|
| // extract userId and type from msg - both string variable
| try{
| this.requestManager.insert(userId, type) // stateless session bean injected with seam
| catch ( JMSException e ){
| e.printStackTrace();
| }
| }
|
The insert Method is as follows:
| public void insertPemRequest( String userId, String type )
| {
| Person person = new Person( userId, type );
| try
| {
| this.entityManager.persist( examRequest );
| this.entityManager.flush();
|
| // create business process in jbpm
| }
| catch ( ConstraintViolationException exp ){
| // do nothing, i.e do not kick off new business process
| }
| catch ( EntityExistsException entityEx ) {
| // do nothing, i.e do not kick off new business process
| }
| }
|
The Person Bean has unique constraint on userId and type: i.e:
| @Entity
| @Table( uniqueConstraints= {@UniqueConstraint(columnNames={"userId", "type"}) } )
| public class Person {
| // ---- getter/setter for id, name, type
| }
|
By catching the EntityExistsException I want to avoid that a business process is kicked off twice for the same person and type. As there might be many messages send and consumed in parallel all requesting to kick off a business process for one person and type combination - this is a good way to control that a business process is kicked off once and once only for a name/type combination.
Now my problem: The message is still redelivered and send to the DLQ, altough I caught the EntityExistsException. All other exceptions should lead to sending the message to DLQ. But not the EntityExistsException as this is a "tolerated" exception. I know from FAQ
anonymous wrote :
| What type of Exceptions should an MDB throw?
| The quick answer is none.
|
But I am catching the exception. right? Or is this correct behaviour and I have to change my design that no EntityExistsException is thrown?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053862#4053862
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053862
18Â years, 11Â months