-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I need to create structured applications in many projects with JPA implemented by EclipseLink.
I would refer to these projects (and possibly EJB) from a ZK project, but I can not get a reference to EntityManager (eg. using annotations like @PersistenceContext) within my ZK project.
I would avoid creating it with an EntityManagerFactory, because I'm not sure about its lifecycle (if I instantiate it, then I need to release it?). Instead I would prefer that the management of the release of the EntityManager were to be executed by the J2EE context in which we are working.
After checking in many forums, and in the ZK documentation, i found that has always been used Spring instead of EJB + EclipseLink. Are there particular motivations?
Example: Eclipse JPA Project (EclipseLink 2.4)
@Entity
public class MyClass implements Serializable { // JPA Annotated Class
@Id private int id;
...
}
Eclipse ZK Project (with the previous in the project reference)
public class IndexController extends SelectorComposer<Component> {
@Wire Intbox edtId;
...
@PersistenceContext
EntityManager em;
@Listen(Events.ON_CLICK+"=#btnFind")
public void find() {
MyClass c = em.find(MyClass.class, edtId); // <-- em is null
}
}
Asked: 2013-06-05 10:51:14 +0800
Seen: 31 times
Last updated: Jun 05 '13
Do not update to ZK Studio 2.0
Catch Server 503 Error - Or Catch Stale Page
how to save spreadsheet data into postgres database?
One controller file with multiple zul file
Why am I getting authentication error for ZK studio activation?
How can i make Tomcat (with virtual hosts) to parse the zul page in subfolders?