[jboss-user] [JBoss Seam] - Re: @Filter example

anescu do-not-reply at jboss.com
Wed May 16 03:51:56 EDT 2007


"fernando_jmt" wrote : Post the page where you are setting the currentHub in the session (where you are using @Out). And also post the code where you are trying to use the entityManager you have configured in components.xml.
  | 

Here is how i use the parameter. It's in a bean that renders a combo box, near the menu:

    @Out(required = false, scope = ScopeType.SESSION)
  |     private Hub currentHub = null;

And as i said, i just changed the generated code for the entity manager to the one that uses also the filter. The only place where we use the entityManager by ourselves is this code, in the authenticate method:

                this.currentUser = (User) this.entityManager.createQuery("from User where username = :username and password = :password").setParameter("username", this.identity.getUsername()).setParameter("password", this.identity.getPassword().getBytes()).getSingleResult();


In the rest, is used under the hood by seam. As i said, i'm new to this so i don't know what i need to override to use a custom entity manager (this way i can use both of them, i guess)

Also, i get the error when opening the first screen (/home.seam if you want), where the menu should be displayed (as i said, the seam-gen web interface). That is why i don't understand why it's trying to load a collection of entities when i have not even authenticated into the application. That is supposed to do the filter, display only the data i'm supposed to see.

Also, it seems i would need to use both entity managers, as the default one seem to be used to load related entities from the DB, i would like to display in the list only the X entities that correspond to a criteria.

So, what methods do i need to override to use a custom entityManager instead of the default one in a Seam generated skeleton???


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046030#4046030

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046030



More information about the jboss-user mailing list