1 2 Previous Next 18 Replies Latest reply on Nov 23, 2009 6:09 PM by asookazian Go to original post
      • 15. Re: Weld and JPA examples
        asookazian

        eclipselink 2.0.0
        2.0.0 Planned Release
        Thu, 10 Dec 2009 05:00:00 GMT

        http://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.x


        not 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

          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

            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

              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?


              Here's one: https://glassfish-samples.dev.java.net/source/browse/*checkout*/glassfish-samples/ws/javaee6/jpa/locking/docs/index.html


              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


              https://glassfish-samples.dev.java.net/source/browse/*checkout*/glassfish-samples/ws/javaee6/webbeans/webbeans-guess/docs/index.html

              1 2 Previous Next