'Impact of mixing Hibernate and JPA tags?

I realize Hibernate is an implementation of JPA but wondered about the implications of mixing JPA and Hibernate tags. I inherited a JBPM application using Hibernate for persistence where the object model's tagging is entirely JPA (i.e., using @javax.persistence annotations) except for references to @org.hibernate.annotations.LazyCollection. After reading many posts like this and this I still wonder:

  1. What are the ramifications or other needed code changes (outside of additional dependencies) for changing from JPA @Entity to Hibernate @Entity? I see many insert/updates that are inserting or updating null values in fields that default to null, so wanted to use @org.hibernate.annotations.Entity(dynamicUpdate = true)?

  2. Despite using the @org.hibernate.annotations.LazyCollection tag and having no data to actually fetch there are many SELECT queries being issued to retrieve dependent entities - more than one query per independent object. I realize there is a JPA approach for LazyCollections - but what mix of tags would be best to ensure that if an object myCar of class Car has a collection of instances of BumperSticker objects that gets queried at most once if there are no instances of BumperSticker's in the database? I may need to shift from Join columns to mappings to get the appropriate resulting queries.

Please note I have not done anything with Spring in this JBPM application because I am just a little more than a novice at Spring.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source