users@glassfish.java.net

Named Query design thoughts

From: <glassfish_at_javadesktop.org>
Date: Thu, 25 Oct 2007 10:30:03 PDT

Hi,

I just had a look at the blueprints page regarding named queries and there are some thoughts that are raised after reading the recommendations. If I declare a named query in an entity bean why don't implement the method within the entity bean, at least when the query has to do with a certain instance of an entity. I don't like the idea that you are creating a named query which takes a couple of parameters within a entity bean and then use this query in a session bean where the only way to know if you are using the right parameters for the query is to look at the code or some documentation. If you implement a method within the entity bean you can encapsulate this and you will definitely know what the order or the names of the parameters are.

What are your thoughts?
[Message sent by forum member 'woel' (woel)]

http://forums.java.net/jive/thread.jspa?messageID=242185