I am trying to implement a database using ObjectDB. To get started i want to write Entities of Type RequirementDBEntity into a database. I followed the tutorials here but when launching the program, i get the following error:
Error occurred during initialization of boot layer java.lang.module.ResolutionException: Module objectdb contains package javax.transaction.xa, module java.transaction.xa exports package javax.transaction.xa to objectdb
My entity class looks like this:
package objectDB; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class RequirementDBEntity implements Serializable { /** * */ private static final long serialVersionUID = 5019171545896480392L; @Id @GeneratedValue private long id; private String name; private String description; private String reqID; private boolean verified = false; public RequirementDBEntity() { } RequirementDBEntity(String reqID, String name) { this.reqID = reqID; this.name = name; this.description = "No description available."; }
And my code for actually writing to the database is:
import javax.persistence.*; public class DatabaseManager { EntityManagerFactory emf = Persistence.createEntityManagerFactory("D://Coding/MESTrackDB/MESTrackDB.odb"); EntityManager em = emf.createEntityManager(); RequirementDBEntity req = new RequirementDBEntity("SRS1", "TestReq1"); em.getTransaction().begin(); em.persist(req); em.getTransaction().commit();
My module-info:
module MESTrack { requires javafx.controls; requires javafx.fxml; requires mleUtility11; requires java.sql; requires objectdb; exports common; exports exceptions; exports gui; opens gui; }
I am using JDK19, ObjectDB V2.8.8_03. I use objectdb.jar from bin folder. I also tried the release version 2.8.8. With the release version 2.8.8 the error is slightly different:
Error occurred during initialization of boot layer java.lang.module.ResolutionException: Modules java.transaction.xa and objectdb export package javax.transaction.xa to module javafx.swt.
Ps.: I am using Eclipse without maven and i am a hobby programmer (engineering student).