Hibernate configuration appears various pit

1.java.lang.ClassNotFoundException: javax.xml.bind.JAXBException

cause of issue:

Java EE JAXB API is the API, so this is no longer included in the Jar package in java SE 9.0.
java 9 introduced the concept of the module, by default, Java will no longer contain java EE SE Jar package
and for this API are tied together at java 6/7 / 8 in

Solution one:

Reduce JDK 9 version to JDK 6/7/8

Solution two :( pro-test feasible)

Jar package manually add these dependencies

To solve this problem, I introduced these four Jar package fixes success.

javax.activation-1.2.0.jar
http://search.maven.org/remotecontent?filepath=com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.jar

jaxb-api-2.3.0.jar
http://search.maven.org/remotecontent?filepath=javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar

jaxb-core-2.3.0.jar
http://search.maven.org/remotecontent?filepath=com/sun/xml/bind/jaxb-core/2.3.0/jaxb-core-2.3.0.jar

jaxb-impl-2.3.0.jar
http://search.maven.org/remotecontent?filepath=com/sun/xml/bind/jaxb-impl/2.3.0/jaxb-impl-2.3.0.jar

The above download these files and copy them to the next libs folder and
add them into Build Path in the
re-run to

2.ERROR: HHH000346: Error during managed flush [org.hibernate.exception.ConstraintViolationException: could not execute statement]

The reason: Because when the primary key pass pass an empty string instead of null, so I can not add a new one.
Solution: Entry own primary key value

3.org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleT

My mistake was not to import the corresponding jar package, jar package Download:
http://www.java2s.com/Code/Jar/j/Downloadjavassist3170gajar.htm
other possible errors Reference Links:
issue 3: HTTPS: // Blog. csdn.net/liuzhengyang1/article/details/23127629

Reference Link:
question. 1: https://blog.csdn.net/jinchunzhao123/article/details/82695556
question 2: https://blog.csdn.net/hadues/article/details/79188793
detailed code reference links: HTTPS: //www.jb51.net/article/115756.htm

Guess you like

Origin blog.csdn.net/weixin_42542536/article/details/91427708