[jboss-user] [JBoss Seam] - Re: EntityConverter: Entity Manager not found

pete.muir@jboss.org do-not-reply at jboss.com
Tue Aug 7 17:26:02 EDT 2007


"mgrouch" wrote : Yes. Requirement to use SMPC is a problem for me.
  | I load list of entities via Stateless Session EJB call (so no SMPC).
  | The entities are reverse engineered from DB at build time by hibernate tools (so no equals() method there).

Hmm. Yes, in this case s:convertEntity won't work, agreed. 

anonymous wrote : Please, take a closer look at my code. Do you think solution provided by Seam for dropdowns is better than mine? So many people keep reporting issues with s:convertEntity...

Yes. I prefer the s:convertEntity approach. And yes, its certainly not perfect, it has , I think, two restrictions:

1) You must use an SMPC to load the list
2) You must be in a conversation

(you can get round both of these by implementing equals)

My main problem with approach you describe below is:

1) You must extend EntitySelector in code.  This works very badly with the Seam Framework and components.xml
2) To keep your entities managed, you must cache all entities in your dropdown in the conversation scope (yes, I know you can put them in the event or page scope, but then they won't be managed).
3) No support for xml mapped entities (and you're not going to get this to work afaics)
4) correct implementation of toString() on all keys (think about composite keys here)

Most can be fixed, but (2) is the killer for me and I can't see how you get round it.

I think its fair to say that s:convertEntity is best used in a fully Seam managed environment (Seam managed transactions, Seam managed persistence context), and probably using the application framework.  

However, what I'm planning to do (as discussed in another thread) is make it possible to swap out parts of the entityconverter, and I will certainly make it possible to swap out the logic which decides *what* to store to in the cache, and what scope the cache should be.  This should mean you can implement what you have below inside the entity converter.

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

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



More information about the jboss-user mailing list