I try to persist my Department
and Mandator
classes to hsqhldb but it gives this error.
Exception Description: [class ch.printsoft.
Remove mappedBy from @OneToMany annotations from Mandator class
Check if all related classes are mapped as @Entity. Department class has @ManyToMany relation to DocumentUser. Provide the listing of DocumentUser class
Ensure you have both classes are defined in your tag of persistence.xml which you tag are using. At time of persistence the entity into DB application finds the entity information from persistence.xml file. If mapping entity is not found application throw this exception.
Please include your persistence.xml
Example: persistence.xml :-
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="mapping_unit">
<class>ch.printsoft.mailhouse.usermgr.entity.Mandator </class>
<class>ch.printsoft.mailhouse.usermgr.entity.Department</class>
...
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/practice" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="root" />
<property name="eclipselink.logging.level" value="SEVERE" />
<property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
</properties>
</persistence-unit>
</persistence>