I am getting this error and I have no idea the reason: Class "Department" is mapped, but is not included in any persistence unit.
I have two project. One is In my persistence.xml, between tag, there is only two lines:
<persistence-unit name="UserJPA">
</persistence-unit>
My class is:
package br.com.jm.user;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;;
@Entity
@Table(name = "DEPARTMENT")
public class Department implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Long id;
private String name;
//getters and setters
}
I am using EclipseLink2.1.2. Actually I can remove this if it makes the things easier.
Hugs, Demetrio
For anyone who finds this old question when searching for the "Class xxxx is mapped, but is not included in any persistence unit" error in Eclipse or RAD, a comment on this question and answer has the solution that worked for me:
These steps worked for me.
You need to specify what classes are included in the persistence unit in the persistence.xml file, like this:
<persistence-unit name="UserJPA">
<class>br.com.jm.user.Department</class>
</persistence-unit>
Right click on persistance.xml file in your project explorer
then click Synchronize Class List
it will generate your Class tags automatically
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With