1 2 Previous Next 18 Replies Latest reply on Nov 23, 2009 6:09 PM by Arbi Sookazian

    Weld and JPA examples

    Steven Boscarine Apprentice

      Is there an example application somewhere which uses JPA? 


      I've gotten things working by cobbling old code in, but I assume the patterns that were optimal with other frameworks may not be the most optimal for a CDI solution.  I noticed the new 1.0 Weld documentation gives a few light examples that use JPA, but don't seem to advocate particular patterns. 


      Since CDI is a very new approach to solving old problems, I'd prefer to learn the intended patterns early on rather than just trying to make my CDI code look like my legacy Spring code.

        • 1. Re: Weld and JPA examples
          Gavin King Master

          There's an example in the spec, but yeah, you're right, there's nothing in the Weld dist. We need something.

          • 2. Re: Weld and JPA examples
            Arbi Sookazian Master

            We need many more example projects in the distro, like Seam...  numberguess is a good starter app for a Weld newbie like me but does not illustrate all the interceptor, decorator, etc. design patterns that are typical of a EE 6 app.


            that's one of the reasons I posted about how to refactor a Seam 2 booking app to Weld booking app using facelets, JSF 2.0 and JPA 2.0 (with or without RichFaces b/c JSF 2.0 now has ajax tags?)...

            • 3. Re: Weld and JPA examples
              Steven Boscarine Apprentice

              Arbi Sookazian wrote on Nov 17, 2009 17:05:

              that's one of the reasons I posted about how to refactor a Seam 2 booking app to Weld booking app using facelets, JSF 2.0 and JPA 2.0 (with or without RichFaces b/c JSF 2.0 now has ajax tags?)...


              JSF 2.0 is final and ready for use.  It has solid documentation, but for some reason it's relatively difficult to find in searches at this exact point. 


              JPA 2.0 is not final.  I have no idea what state it's in or if it's close enough to ready that I could start an app in it now and be assured it would be stable by project completion in 6 months.  


              I have no idea what state Richfaces 4.0 is in.  Jay Balunas hinted at a lot of cool features way back in a New England Java User Group presentation awhile back, but I haven't had time to pursue it. 


              Certainly the faster they get these examples out, the higher the JEE6 adoption rate will be. 


              January 1st is also a magic date. 


              After the holidays, most companies start making decisions as to what development initiatives they're going to take.  A lot more developers are going to be figuring out what technology their latest project, module, or application rewrite will use during the first 8 weeks of the year than the any other time of year. 

              • 4. Re: Weld and JPA examples
                Francisco Jose Peredo Noguez Master

                If I have time, I plan on matching every JSF+Weld+JPA example published with a JSP+Weld+JDBC equivalent... so... please build one!

                • 5. Re: Weld and JPA examples
                  Arbi Sookazian Master

                  I think it may be very premature for JEE IT shops to adopt and use/deploy JEE 6-based apps starting January 1st with the RI of EE 6 (Glassfish V3).


                  typically, most shops, whether .NET or Java shops, are one major release behind (e.g. we were using .NET framework 1.1 and 2.0 at my last shop but also Seam stack) to ensure all the bugs are worked out with the app servers and frameworks, RIs, etc.  You also don't want to be the guinea pig in a prod envmt when it comes to performance/scaling issues.


                  But it's always good to know what is around the corner when it comes time to start analyzing options and making recommendations and doing POCs.

                  • 6. Re: Weld and JPA examples
                    Arbi Sookazian Master

                    Francisco Peredo wrote on Nov 17, 2009 17:30:


                    If I have time, I plan on matching every JSF+Weld+JPA example published with a JSP+Weld+JDBC equivalent... so... please build one!


                    Spring JdbcTemplate?  or traditional JDBC?

                    • 7. Re: Weld and JPA examples
                      Francisco Jose Peredo Noguez Master

                      Arbi Sookazian wrote on Nov 17, 2009 17:49:



                      Francisco Peredo wrote on Nov 17, 2009 17:30:


                      If I have time, I plan on matching every JSF+Weld+JPA example published with a JSP+Weld+JDBC equivalent... so... please build one!


                      Spring JdbcTemplate?  or traditional JDBC?


                      Spring JdbcTemplate of course! what do you think? that I am masochistic? ;-)


                      I have thought about creating an equivalent to Spring-JDBC named Weld-JDBC as part of Solder, but I am not sure it is worth the effort...it feels like reinventing the wheel...

                      • 8. Re: Weld and JPA examples
                        Francisco Jose Peredo Noguez Master

                        Francisco Peredo wrote on Nov 17, 2009 18:01:


                        I have thought about creating an equivalent to Spring-JDBC named Weld-JDBC as part of Solder, but I am not sure it is worth the effort...it feels like reinventing the wheel...


                        Make that Solder-JDBC since, obviously, I could not name it Weld-JDBC because I do not work at JBoss ;-)

                        • 9. Re: Weld and JPA examples
                          Gavin King Master

                          JPA 2.0 is not final. I have no idea what state it's in or if it's close enough to ready that I could start an app in it now and be assured it would be stable by project completion in 6 months.

                          JPA2 itself is done, just waiting for the EC vote, like CDI.


                          Our implementation of JPA2 is not finished yet, though Steve has already made a lot of progress on it.

                          • 10. Re: Weld and JPA examples
                            Steven Boscarine Apprentice

                            Arbi Sookazian wrote on Nov 17, 2009 17:47:


                            typically, most shops, whether .NET or Java shops, are one major release behind (e.g. we were using .NET framework 1.1 and 2.0 at my last shop but also Seam stack) to ensure all the bugs are worked out with the app servers and frameworks, RIs, etc.



                            That's always a tough question.  The risk-adverse groups will definitely choose to stay a version behind, but I find that more true of Databases, Operating Systems, and Server containers than libraries used.  It's much cheaper to upgrade software (DB/OS/container) than libraries in a custom application anyway. 


                            For example, you could start a 2 year project in JSF 1.2 right now, but that would be foolish because JSF 2.0 is so much better and will likely never be the bottleneck of your application.  Also, midway though the project JSF 2.0 will most likely be a few point revisions ahead if there were bugs in the RI.  By the time the project is delivered, JSF 1.2 will be obsolete and barely supported.  By delivery, you'll also see all the cool features and widgets coming out for JSF 2.0, skipping 1.2. 


                            There are clear penalties for being too aggressive or too risk-adverse.  Sorry for the tangent.  I promise I'll stay on topic.  I just wanted to point out demand in the community for learning the optimal patterns for persistence in Weld and magic of January.  It's a sign we like what you put out and want to learn more. 

                            • 11. Re: Weld and JPA examples
                              Arbi Sookazian Master

                              Gavin King wrote on Nov 17, 2009 18:13:


                              JPA 2.0 is not final. I have no idea what state it's in or if it's close enough to ready that I could start an app in it now and be assured it would be stable by project completion in 6 months.

                              JPA2 itself is done, just waiting for the EC vote, like CDI.

                              Our implementation of JPA2 is not finished yet, though Steve has already made a lot of progress on it.


                              What about the RI for JPA 2?  Is that still TopLink?  And are all the RIs complete for EE 6 and sub-projects/JSRs?


                              If/when I download JBoss 6 will it have everything I need to start writing a Weld app?

                              • 12. Re: Weld and JPA examples
                                Francisco Jose Peredo Noguez Master

                                Arbi Sookazian wrote on Nov 18, 2009 01:17:



                                What about the RI for JPA 2?  Is that still TopLink? 


                                It is now called EclipseLink.


                                • 13. Re: Weld and JPA examples
                                  Arbi Sookazian Master

                                  Gavin King wrote on Nov 17, 2009 18:13:


                                  JPA 2.0 is not final. I have no idea what state it's in or if it's close enough to ready that I could start an app in it now and be assured it would be stable by project completion in 6 months.

                                  JPA2 itself is done, just waiting for the EC vote, like CDI.

                                  Our implementation of JPA2 is not finished yet, though Steve has already made a lot of progress on it.


                                  Ok, so what's the plan with adding JPA examples with hsqldb or mysql db, etc. in the weld distro?  Are you guys planning on waiting for the Hibernate JPA 2.0 provider implementation to be completed and tested or go ahead with EclipseLink?  I bet the former...  So that would explain why there are no JPA examples in the Weld distro yet...

                                  • 14. Re: Weld and JPA examples
                                    Nicklas Karlsson Master

                                    The reason is probably lack of time. Not that big a difference if the example is JPA 1 or JPA 2 from the viewpoint of Weld.

                                    1 2 Previous Next