File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes JSF 2 with JDO 2.3 (is it a bad practice to make a class PersistenceCapable,ManagedBean ) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "JSF 2 with JDO 2.3 (is it a bad practice to make a class PersistenceCapable,ManagedBean )" Watch "JSF 2 with JDO 2.3 (is it a bad practice to make a class PersistenceCapable,ManagedBean )" New topic
Author

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

Daniel Reznick
Ranch Hand

Joined: Oct 23, 2008
Posts: 48

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
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JSF 2 with JDO 2.3 (is it a bad practice to make a class PersistenceCapable,ManagedBean )
 
Similar Threads
ViewScoped bean using ManagedProperty
Implicit navigation redirect causing new session
What are First Class Objects?
Java Data Objects - Chapter 1
JSF with other technologies, Hibernate