Christian Groove [http://community.jboss.org/people/TheGroove] created the discussion
"Weired JPA named query @NamedQuery behaviour" To view the discussion, visit: http://community.jboss.org/message/582625#582625 -------------------------------------------------------------- Salut i recogniozed a strange behaviour, declaring anmed queries with a annotation. Here is some code: @NamedQueries( { @NamedQuery( name=Dbean1.GET_COMPOSITION, query=Dbean1.JPQL_COMPOSITION) } ) where: @Entity public class Dbean1. implements Serializable { /* some code */ final public static String GET_COMPOSITION = ".... composition " ; final public static String GET_COMPOSITION = "SELECT dbean FROM ..... " ; this looks fine. But imagine iff you a to implement a recurring part of the where expression and start thinking of a java code, that could help you to create that JPA-QL string. So when you write: @Entity public class Dbean1. implements Serializable { /* some code */ final public static String GET_COMPOSITION = ".... composition " ; final public static String *GENERATED_WHERE_EXPR* = generateWehreCompo() ; final public static String GET_COMPOSITION = "SELECT dbean FROM ..... + WHERE" + *GENERATED_WHERE_EXPR* ... ; JBoss5.1 will tell you "+The value for annotation attribute NamedQuery.query must be a+ +constant expression+" So is final private static not constant enough ??? -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/582625#582625] Start a new discussion in EJB3 at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
