users@glassfish.java.net

Re: Enumeration mapping JPA

From: Sahoo <Sahoo_at_Sun.COM>
Date: Thu, 18 Oct 2007 16:35:27 +0530

glassfish_at_javadesktop.org wrote:
> Thanks for the advice. It was really helpful.
>
> Since it was Strings in the enum in the database I had to change the enum in Java to have String arguments. There is however a problem with this solution. If I create queries in my session beans which selects entities which has this construction I still have to use the persistent field in my where statement to filter the entities but I guess I have to live with that.
>
I don't see any alternative.
> I could also use some design advice:
>
Would you mind taking a look at the suggestions made at
https://blueprints.dev.java.net/bpcatalog/ee5/persistence/index.html
from the Blueprints team?

Thanks,
Sahoo
> Do you usually put EJB QL queries in you entity or session beans? I currently have all queries in my session beans. If I for example want to filter a set of entities in a one-to -many relationship, would you add a getter method to the entity bean which retrieves them with a EJB QL query?
>
> Also, do you have a solution how to create a query where you want to filter the result in where statement for all entities that exist in a set. Example "select objects from table where objects.value in ('x','y','z')". I have only managed to create a query like this by just building a String. I cannot seem to use query.setParameter and replace the values in the in statement with a ":set".
> [Message sent by forum member 'woel' (woel)]
>
> http://forums.java.net/jive/thread.jspa?messageID=240873
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>