-
15. Re: Weld and JPA examples
asookazian Nov 23, 2009 5:48 PM (in response to sboscarine)
eclipselink 2.0.0
2.0.0 Planned Release
Thu, 10 Dec 2009 05:00:00 GMThttp://www.eclipse.org/projects/timeline/index.php?projectid=rt.eclipselink
Well, perhaps I can look into using JPA 1.0 with Hibernate as persistence provider using hsqldb like in Seam 2.x distro apps. One of the problems I have as a newbie with JEE 6 is understanding what versions of what frameworks will be compatible with what version of what app server.
e.g.
1) JSF 1.2, Weld 1.0, JPA 1.0, EJB 3.1, JBoss 4.x/5.x
2) JSF 2.0, Weld 1.0, JPA 1.0, EJB 3.0, JBoss 4.x/5.x
3) JSF 2.0, Weld 1.0, JPA 2.0, EJB 3.1, JBoss 4.x/5.xnot to mention Bean validation, etc.
As far as these combinations of versions are concerned, what strict requirements does Weld impose (I'm assuming preferably a JEE 6 app server but then again I imagine it will run with Tomcat 6)??
Perhaps it's better to wait for JBoss final release of app server 5.x or 6.x which contains Hibernate implementation of JPA 2.0, JSF 2.0 RI, CDI RI (Weld 1.0.0), etc.
-
16. Re: Weld and JPA examples
asookazian Nov 23, 2009 5:50 PM (in response to sboscarine)In reference to above post, is there a document provided by EE 6 EG that delineates the required versions and possible valid combinations of older/newer versions of APIs?
-
17. Re: Weld and JPA examples
asookazian Nov 23, 2009 5:55 PM (in response to sboscarine)
Gavin King wrote on Nov 17, 2009 16:58:
There's an example in the spec, but yeah, you're right, there's nothing in the Weld dist. We need something.Where in the spec is the example (which section)? I found a few references to @PersistenceContext in the spec but I'd like to see a full example with the persistence.xml, etc.
Maybe this one:
@SessionScoped public class Permissions { @Produces private Set<Permission> permissions = new HashSet<Permission>(); @Inject @Users EntityManager userDatabase; Parameter<String> usernameParam; CriteriaQuery<Permission> query; @Inject void initQuery(@Users EntityManagerFactory emf) { QueryBuilder qb = emf.getQueryBuilder(); usernameParam = qb.parameter(String.class); query = qb.create(Permission.class); Root<Permission> p = query.from(Permission.class); query.select(p); query.where( qb.equal(p.get(Permission_.user).get(User_.username), usernameParam) ); } void onLogin(@Observes @LoggedIn User user) { permissions = new HashSet<Permission>( userDatabase.createQuery(query) .setParameter(usernameParam, user.getUsername()) .getResultList() ); } void onLogout(@Observes @LoggedOut User user { permissions.clear(); } }
It would be nice to have a [CODE]FOO[/CODE] markup wiki tag here....
But I'd like to see a simple example...
-
18. Re: Weld and JPA examples
asookazian Nov 23, 2009 6:09 PM (in response to sboscarine)what artifacts are required for a session bean JPA example in EE 6 app server like JBoss 6? Is it still foo-ds.xml and persistence.xml? Is there perhaps a non-Weld example to learn from?
but it's
designed
for Glassfish V3, Java DB database and NetBeans. I wonder what version of JPA 2.0 RI it's using?Consequently, needs to be renamed?:
The JSF 2.0 Web Beans Sample Application