Every time I run my code, I get the following error:
java.lang.RuntimeException: javax.annotation.processing.FilerException: Attempt to recreate a file for type domein.ClubLes_
[javac] at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:407)
[javac] at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:964)
[javac] at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:881)
[javac] at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2100(JavacProcessingEnvironment.java:110)
[javac] at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1202)
[javac] at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1311)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1250)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:928)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:306)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:165)
[javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
[javac] at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
[javac] Caused by: javax.annotation.processing.FilerException: Attempt to recreate a file for type domein.ClubLes_
[javac] at jdk.compiler/com.sun.tools.javac.processing.JavacFiler.checkNameAndExistence(JavacFiler.java:727)
[javac] at jdk.compiler/com.sun.tools.javac.processing.JavacFiler.createSourceOrClassFile(JavacFiler.java:489)
[javac] at jdk.compiler/com.sun.tools.javac.processing.JavacFiler.createSourceFile(JavacFiler.java:426)
[javac] at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.generateCanonicalModelClass(CanonicalModelProcessor.java:98)
[javac] at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.generateCanonicalModelClasses(CanonicalModelProcessor.java:226)
[javac] at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:403)
[javac] ... 11 more
BUILD FAILED
E:\ProjectJava\java-g11\Taijitan\nbproject\build-impl.xml:1134: The following error occurred while executing this line:
E:\ProjectJava\java-g11\Taijitan\nbproject\build-impl.xml:381: Compile failed; see the compiler error output for details.
At first I thought it was because I accidently forgot to add the subclass, but it's still giving me the same error. ClubLes inherits from Les, which is an interface which contains only getters. Do I need to make the interface serializable aswell? I have no idea what's going wrong.
ClubLes
@Entity
public class ClubLes implements Serializable, Les {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "LesId")
private int id;
@Column(name = "Naam")
String naam;
@Column(name = "Soort")
String soort;
@ManyToOne
@JoinColumn(name = "GraadNumeriek")
Graad graad;
@Column(name = "FotoUrl")
private String fotoUrl;
@Column(name = "Beschrijving")
private String beschrijving;
@Column(name = "VideoUrl")
private String videoUrl;
public ClubLes() {
}
Les interface
public interface Les {
int getId();
String getNaam();
String getSoort();
//More getters
}
PU
I only have one persistence unit, which looks like this
<?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="TaijitanPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>domein.Graad</class>
<class>domein.Locatie</class>
<class>domein.ClubPersoon</class>
<class>domein.ClubActiviteit</class>
<class>domein.ClubLes</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost:1433;databaseName=Taijitan"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="javax.persistence.jdbc.password" value="Wachtwoord2019"/>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
</persistence-unit>
</persistence>
I also noticed that when I remove clublesson from JPA, it throws the same error for ClubPersoon, which follows the same scheme
persistence.xml
? – Clinic