[jboss-user] [JBoss Seam] - Problem with injection

thierry.rietsch do-not-reply at jboss.com
Thu May 31 11:40:51 EDT 2007


Hi all

I have a problem with injection.

I have an interface called SearchCriteria and three classes (Entities) which implement this interface. Additional I have an EJB which saves the entities in the database. The search criteria gets injected into the bean from the facelet. Therefor I have three facelets which cover the fields of the entities. All this facelets call the EJB.save() methods and pass the search criteria object.

Now I figured out, that I need to annotate the entity (@Name("..")) the same as the field name in the EJB is named (else other facelets and beans don't work. Is this correct?). This leads me into a problem as I have three different annotations for the names of the entities but one field name in the EJB which saves the entitites. How can I solve this?

-> In the EJB save method, I compare an enum value to figure out what kind of object it is. Then I cast it to the right class and persist it then with the entity manager. I know that using a command pattern would be the better way (figured it out just a few minutes before), but this wouldn't change my problem.

Thanks for your help and your answers,

Thierry

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

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



More information about the jboss-user mailing list