Rookie Wrong (vi)--hibernate 4.3.x annotations common errors and solutions

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.