• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF 2 with JDO 2.3 (is it a bad practice to make a class PersistenceCapable,ManagedBean )

 
Daniel Reznick
Ranch Hand
Posts: 50
Eclipse IDE Google App Engine jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heya!

I building an web app using JSF2 and JDO and i have a User class which supposed to hold all user information (session scoped) , the thing is that i will have the same data saved in db, so the question is, wont it be better to make ONE class to serve as managed bean session scoped and PersistenceCapable ?

Or create to seperate classes and hold the same data in them both? (this sounds like to much maintenance)

e.g.

@PersistenceCapable(identityType = IdentityType.APPLICATION)
@ManagedBean(name="xyz")
@SessionScoped

I have seen some posts about jsf and jpa... but not jdo....

Any suggestions?

Thanks ahead

Daniel
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aside from the maintenance issues that arise when you don't keep clearly-defined tiers in your application, there's a fundamental problem with any sort of object which can be replaced in its entirety, JPA, EJB, or DIY. That's because the managed bean facility isn't designed to delete and replace objects - at least in JSF1. The closest you can get is Request-scope objects, but Request scope tends to have issues in JSF because it's too short a scope to support postback operations well. They actually added a new scope in JSF 2 for just that reason.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!