Programming process inevitably encountered a variety of errors, various problems, and encountered problems, solve the problem of the process I think is the most exciting thing. The more difficult the problem is, the greater the pleasure it will bring after the solution. When you're having a problem for an afternoon or a day, or even a few days, you'll feel like you're reborn again when you're done with the moment. You may even feel that the whole world is yours at this moment.
Oh, it's a little far. So, what we're going to talk about today is some of the common mistakes of hibernate. We all know that the Java Project Update one version may be very different from the previous version, the change can be very large at times. For example, Struts1 and struts2, such as spring3.x, are split into multiple jar packages by the original jar package. So sometimes the issue of version conflict can cause us a lot of trouble. Let's talk about some of the things you should be aware of when using hibernate4.3.x.
Error One
Error message: javax.persistence.Table.indexes ([Ljavax/persistence/index
Cause: Hibernate4.3 does not support @table (name= "tablename")
Solution: Use @entity (name="tablename") instead of @table (name= "tablename")
Error two
Error message:Javax.persistence.JoinColumn.foreignKey () Ljavax/persistence/foreignkey
Cause: Hibernate4.3 cannot be used when many-to-one mappings @JoinColumn
Solution: Write @manytoone only
Error three
Error message:javax.persistence.OneToMany.orphanRemoval () Z
Cause: Java EE, EJB, or JUnit jar packages conflict with Hibernate-jpa-2.0-api-1.0.0.final.jar
Solution: See if there are any of the above jar packages, if present, remove them
Some people say that the wrong one may be a bug, but there is no conclusive conclusion yet. Error two if there is a corresponding @onetomany, then @JoinColumn (name= "corresponding entity _id") in that place.
These are some of the recent problems encountered in the project, write to share with you, hoping to help some people, welcome to add, I will update everyone's feedback to blog post.
Rookie Wrong (vi)--hibernate 4.3.x annotations common errors and solutions