8 Replies Latest reply on Dec 13, 2010 4:56 AM by Karsten Wutzke

    Is Hibernate a joke as JPA provider?

    Karsten Wutzke Expert

      It ultimately relates to this:
      http://stackoverflow.com/questions/4334759/is-hibernate-a-joke-when-it-comes-to-certain-mappings-nested-composite-primary


      The Hibernate forum is almost dead, so I am trying to get some Hibernaters involved from here.


      Please share your opinions.


      Thanks
      Karsten

        • 1. Re: Is Hibernate a joke as JPA provider?
          Tim Evers Master

          This is not an opinion forum.


          This forum is for questions and discussions related to Seam. If you have problems with Hibernate then talk about it on the Hibernate forums.


          If you are not getting a response on those forums try change your wording so you don't sound like someone with an axe to grind. The way you ask your questions will certainly impact people's desire to answer you.


          Secondly, have you raised a JIRA for the Hibernate team to look at? Did it include a nice simple example app that reproduces the problem for them? My guess is No.


          As a developer you should be most aware that when coding complex pieces of software it is generally accepted that there are bugs. You may have found one. Hibernate is a very decent JPA provider that is used by LARGE corporations and systems. Trying to infer that it is a joke because it currently doesn't support a very seldom used mapping is not the right way to go about things if you actually want people to help you.


          Last but not least. Hibernate is open source. If this is a massive deal breaker for you then download the source and fix it yourself. You are not paying the Hibernate team for support so demanding answers or support from them is wrong.

          • 2. Re: Is Hibernate a joke as JPA provider?
            Karsten Wutzke Expert

            I intentionally flagged this as slightly OT beforehand, because the Hibernate forums are effectively dead.


            I have raised about 10-15 JIRA issues and 80% of them include(d) an SSCCE. Your guess is wrong.


            HA! I have done extensive researching and testing. Hibernate fails with 3 of 4 possible ways to annotate composite primary key and entity classes. EclipseLink OTOH fails with only 1 of 4. And composite primary keys are all but seldom, at least not on the DBs I work with. Don't know about you...


            I thought about fixing things myself, but I couldn't even get all the sources to my machine. Then, it's sheer size ultimately freaked me out. It's no coincidence they don't have everything under full control, at least not easily (that's my guess here).


            As a matter of fact, given that Hibernate is such an old tool now, it does certain mappings astonishingly bad. If you stick to ID based designs, that's okay, but it's not what I learned at my university.


            Karsten

            • 3. Re: Is Hibernate a joke as JPA provider?
              Tim Evers Master

              Let me start of with what you learn at university is seldom what is used in the real world. 1 year after I finished university I realised that most of the code I now write is nothing like what I was taught at university. Why? The answer is simple. University is not there to make you a good developer. University is there to get you to understand the basics of becoming a developer. The real world is where you learn how to become a good developer. So forget about university, it was there so you could understand how to formulate a design. How to read and understand specs. How to write code. Not, how to do it well.


              I've only been a developer for around 3-4 years now and I learn new things consistently. Just looking back at code I wrote just a year ago I realise I sill have much more to learn.


              Composite keys are a very interesting topic. There are 2 camps who are hell bent on the fact that they are right. On one side composite keys are logical, on the other they are tedious. Depending on how you use your database composite keys are either extremely efficient or incredibly inefficient. In fact from table to table the use of composite keys may be beneficial or detrimental. Table structure, indexing, query patterns and the database you use ultimately effect the choices in key structure.


              However, the surrogate key pattern which is what I use in every application I work on is arguably the best design. Especially when working with a tool like Hibernate. This allows for much simpler table design. Much narrower primary/foreign key index tables (although this depends on how your database handles keys). Much easier queries, and in a lot of cases faster queries.


              A good way to look at it is like this. There are 2 ways to key your database. Use the business keys or create your own. The advantage of using business keys is that your BAs and business people will understand what you've done. The downside is that now all your technical work has to use business keys. Or you could use technical keys (surrogate keys) and then use a database unique constraint to enforce the business key.


              At the end of the day there is no right or wrong way of doing it. But, I would really recommend thinking very hard about why you need a composite key.


              That all being said, you may really have a need for a composite key. It happens, we have a few composite keyed tables in our app. In which case you may have found a bug. But, to think that someone new to ORM has raised 10-15 JIRAS in a short time frame would either indicate that you are extremely unlucky considering how established hibernate is. Or, you are not using the tool the way it is designed to be used.


              At the end of the day though, Hibernate is an open source tool. If you cannot fix it yourself and you are not paying the Hibernate team to fix it for you then there is no developer who is going to respect someone who is ranting about the inferiority of a free library.


              I've compiled the Hibernate source before. It is not hard. And like other people suggested in the link you gave. You can use a different library.

              • 4. Re: Is Hibernate a joke as JPA provider?
                Leo van den berg Master

                Dear Karsten,


                I promised myself not to answer you anymore, but after reading your annoying email, I couldn't resist..


                You kept me busy for a while with another of your excellent questions. As answered in one of your other threads; you're not a provisional developer and you doing this for the fun. I also started decennia ago as a hobby programmer, but at the moment I (and a lot of other forum users) do this for a living, and most of us here are really happy with excellent tools like Hibernate.


                Maybe you should start 2011 with a more positive attitude ?


                Best regards,


                Leo


                P.S. If I could vote for excluding people from this forum, you really would be number one on my list.









                 

                • 5. Re: Is Hibernate a joke as JPA provider?
                  Karsten Wutzke Expert

                  You're partly right, but it's not a hobby. I'm exploring JPA, Hibernate, and Seam more or less from scratch, because I was really unhappy with the things I had learned and done previously. I felt like I was/am on the right track now. I then realized the hard way that Hibernate and Java ORMs in general have issues that are beyond comprehension for beginners - actually for nobody. I really respect Hibernate, don't get me wrong, but it's not fun when your mappings that should work actually aren't working and the none of the bugs you've reported months ago have even received any status updates. That frustrated me at times.


                  About the positive attitude: I'm working on it, but JPA ORMs actually don't make that taks easier. You have to know very well which ORM can handle which mappings, and this makes JPA really a challenge. When I started out learning this mid 2010 I read someone saying that JPA, Hibernate isn't that hard. That guy should be lapidated.


                  If you're the type of guy that simply follows the one path that's working, okay, but it's not the way my brain works. I just see too many inconsistencies and my fault is probably I can't resist to explore these things (given the fact that I wrote a JPA entity class generator I put myself into the position to experiment with all variants of composite key mappings: JPA 1.0 @IdClass, JPA 1.0 @EmbeddedId, JPA 2.0 @IdClass, and JPA 2.0 @EmbeddedId).


                  I'm beyond the frustrations with JPA mappings now, and if it calms you down EclipseLink also has issues, some of which actually block me from using it. I'm back to Hibernate now.


                  Karsten


                  PS: My luck you can't vote for people to be excluded on this forum. After all, freedom of speech is a fundamental right.
                  PSS: Note that I sometimes tend to exaggerate...

                  • 6. Re: Is Hibernate a joke as JPA provider?
                    Karsten Wutzke Expert

                    Now you did share some of your opinions. ;-) I'm just the type of guy who doesn't accept things that aren't working. I've discovered most developers will try to find a workaround rather than the cause and report it. I'm pretty stubborn and I will continue to report bugs as I find them, which can only make this better software.


                    Yes, I believe I'm one of these unlucky guys running into a ton of problems, also because I have a plugin that enables me to generate the appropriate entity classes from a DB model within seconds, so I gave every JPA variant a shot at Hibernate and EclipseLink. Both have mapping issues, but Hibernate has more. Note that my complaints about Hibernate clearly address mapping issues, I have never criticized Hibernate for anything else.


                    I've accepted the situation now, given my raised understanding of these tools and my own about JPA. I have to admit I probably have to withdraw 3 or 4 bugs from the Hibernate bug tracker as I've found out in the meantime that my code wasn't always right when I reported some bugs.


                    JPA/Hibernate is all but easy and has a tremendous learning curve when done the way I did it...


                    Karsten

                    • 7. Re: Is Hibernate a joke as JPA provider?
                      Tim Evers Master

                      Building a building from the top down is always going to be harder then building from the bottom up.


                      JPA/Hibernate is all but easy and has a tremendous learning curve when done the way I did it... 
                      



                      when done the way I did it... 
                      

                      • 8. Re: Is Hibernate a joke as JPA provider?
                        Karsten Wutzke Expert

                        ... which absolutely isn't the way I implement software. It's not about direction, but simply the accuracy I use.


                        Karsten