jpa, exception Predeployment of PersistenceUnit failed

coleman_

Mitglied
hallo leute

ich sehe langsam den wald vor lauter bäumen nicht.
ich besitze mehrere jpaklassen die halt verlinkt sind.

ich zeige euch mal die zwei Klassen, bei dem die exception auftaucht:

Java:
@Entity
public class Term
{
@Id
private Integer termId;
@OneToMany(mappedBy = "owner")
private List<Modul> moduls;
public Term()
{

}

public Term(Integer termId)
{
this.termId = termId;
moduls = new ArrayList<Modul>();

}
public Integer getTermId()

{
returntermId;

}
public List<Modul> getModuls()

{
returnmoduls;

}

public void setModul(Modul modul)
{
moduls.add(modul);
}






@Entity
publi cclass Modul
{
@Id
private Integer modulNr;
private String modulDescription;
// @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "termId")
private Term term;
@OneToMany(mappedBy = "owner")
private List<SchoolGrade> schoolGrades;
private Double schoolGradeAverage;



public Modul()
{
}


public Modul(Integer modulNr, String modulDescription)
{
this.modulNr = modulNr;
this.modulDescription = modulDescription;
schoolGrades = new ArrayList<SchoolGrade>();
}


public Integer getModulNr()
{
returnmodulNr;
}



public String getModulDescription()
{
returnmodulDescription;
}
public void setModulDescription(String modulDescription)
{
this.modulDescription = modulDescription;

}




public Term getTerm()
{
returnterm;
}

}

folgend die exception:

Code:
Exception in thread "main" Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@c387f44
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [school] failed.
Internal Exception: Exception [EclipseLink-7154] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The attribute [moduls] in entity class [class entity.Term] has a mappedBy value of [owner] which does not exist in its owning entity class [class entity.Modul]. If the owning entity class is a @MappedSuperclass, this is invalid, and your attribute should reference the correct subclass.
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
 
Zuletzt bearbeitet von einem Moderator:

stg

Top Contributor
Der Term in Modul heißt term und nicht owner.
Außerdem fehlt die @ManytoOne annotation, die du dort auskommentiert hast, aber der Fehler, den du gepostet hast, beschreibt das zuerst genannte Problem.

Deine Methode setModul solltst du außerdem umbennen, zum Beispiel in addModul Das ist ja schließlich keine setter-Methode.
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
KOKASS Exception bei Datenbankconnect Datenbankprogrammierung 9
Kirby.exe SQL-Exception: Column not found Datenbankprogrammierung 6
S MySQL hibernate exception: illegal state exception : entityManagerFactory is closed Datenbankprogrammierung 5
G MySQL Java Problem: Nullpointer Exception obwohl Daten vorhanden sind? Datenbankprogrammierung 2
G PostgreSQL Nach Monaten auf einmal ClassNotFound-Exception Datenbankprogrammierung 3
K JPA Projekt Exception Datenbankprogrammierung 7
M CommunicationLinkError - NullPointer Exception Datenbankprogrammierung 11
T MongoDB: Morphia REST 505 Exception Tomcat Datenbankprogrammierung 2
M SQL-Exception trotz funktionierendem SELECT Datenbankprogrammierung 4
N JDBC: rollback() bei Exception geht nicht!? Datenbankprogrammierung 1
M SQL Exception Datenbankprogrammierung 6
L Probleme mit DriverManager.getConnection(..) - Endlosschleife, Java Absturz, Keine Exception Datenbankprogrammierung 4
D Hibernate SaveOrUpdate Exception Datenbankprogrammierung 2
E MySQL Hibernate mit JaxWS führt zu LazyInitialization Exception Datenbankprogrammierung 8
E PostgreSQL Exception too ...many clients already bei DB-Abfrage Datenbankprogrammierung 14
T java sql exception getDate() Datenbankprogrammierung 2
O Viele Verbindungen-Exception bei insert Daten zur MySQL-Datenbank Datenbankprogrammierung 2
E Sql Exception Datenbankprogrammierung 14
M NestedTransaction- Exception in Hibernate Datenbankprogrammierung 15
F Derby/JavaDB SQL-Exception...Aber wieso!? :/ Datenbankprogrammierung 2
T Exception ResultSet Datenbankprogrammierung 7
Paristick MSSQL - JDBC Exception beim Registrieren Datenbankprogrammierung 5
S Null Pointer exception statement Datenbankprogrammierung 8
G JDBC Exception Datenbankprogrammierung 3
S ResultSet einer Datenbankabfrage - Nullpointer Exception Datenbankprogrammierung 13
F Derby/JavaDB Exception - Cannot accept Null Value (help) Datenbankprogrammierung 10
G Stored Procedure Exception Handling Datenbankprogrammierung 3
C SQL Exception auf Unique überprüfen Datenbankprogrammierung 5
B Hibernate+JPA Exception in persistence.xml Datenbankprogrammierung 5
L SQL Exception Problem Datenbankprogrammierung 7
M hilfe zur einer Exception Datenbankprogrammierung 2
J Nullpointer Exception bei Zugriff auf Datenbank Datenbankprogrammierung 13
A MySQL Anbindung - Exception Handling Datenbankprogrammierung 2
R SQL Exception: Cursor position not valid Datenbankprogrammierung 7
O Oracle 11g wirft bei 90 % der installation eine Exception ? Datenbankprogrammierung 5
R Warum kommt eine Exception bei instanceof ? Datenbankprogrammierung 4
B SQL Exception Datenbankprogrammierung 9
E Datenbankverbindung Java MySQL Exception Datenbankprogrammierung 10
N Class not found Exception Datenbankprogrammierung 2
A Exception in thread "AWT-EventQueue-0" java.lang.N Datenbankprogrammierung 4
M SQL Exception bei LIMIT Datenbankprogrammierung 11
megachucky Problem mit: SQL Exception Before start of result set Datenbankprogrammierung 2
W updateRow() schmeißt eine Exception, weil schreibgeschützt Datenbankprogrammierung 6
M Sql Anfrage wirft Exception Datenbankprogrammierung 5
6 Communications link failure due to underlying exception Datenbankprogrammierung 10
R SQL Exception "Weiterleiten der Egebnissmenge" Datenbankprogrammierung 15
märliprinz Exception in thread "main" java.lang.OutOfMemoryEr Datenbankprogrammierung 9
S Java SQL-Exception bei Zugriff auf MSAccess Datenbankprogrammierung 2
K Exception bei Verbindungsaufbau Oracle Datenbank Datenbankprogrammierung 13
L "desc tablename" liefert SQL Exception mit execute Datenbankprogrammierung 6
M SQL Exception Datenbankprogrammierung 3
M Problem mit dem ActionListener und SQL Exception Datenbankprogrammierung 6
D Exception bei ResultSet.moveToInsertRow Datenbankprogrammierung 6
EagleEye problem mit exception Datenbankprogrammierung 2
L UPDATE löst Exception aus Datenbankprogrammierung 6
V Exception beim Speichern von eingegebenen Daten in Tabelle Datenbankprogrammierung 2
G ich bekomm immer die exception grrrr Datenbankprogrammierung 3
D Unklare SQL Exception Datenbankprogrammierung 3
P MySQL [PersistenceUnit: lmoneta] Unable to build EntityManagerFactory Datenbankprogrammierung 5

Ähnliche Java Themen

Neue Themen


Oben