I have these entities:
Run entity:
#Entity
#Table(name = "run")
#JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "runId")
public class Run implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "run_id")
private Long runId;
#Column(name = "status")
private Integer status;
#Column(name = "create_date")
private Date date;
#Column(name = "config_id")
private Long configId;
#Column(name = "stream_id")
private Long streamId;
#OneToOne(mappedBy = "run", cascade = CascadeType.ALL, orphanRemoval = true)
#JoinColumn(name = "run_id", unique = true, nullable = true, insertable = true, updatable = true)
private StreamRun streamRun;
...
}
and StreamRun entity:
#Entity
#Table(name = "stream_run")
#JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "streamId")
public class StreamRun implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
#Id
#Column(name = "id")
private Long streamId;
#Column(name = "run_id", insertable = false, updatable = false)
private Long runId;
#Column(name = "stream_name")
private String streamName;
#OneToOne
#JoinColumn(name = "run_id")
private Run run;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "stream", orphanRemoval = true, targetEntity = JobRun.class)
private List<JobRun> jobs = new ArrayList<>();
#OneToMany(cascade = CascadeType.ALL, mappedBy = "streamRun", orphanRemoval = true, targetEntity = StreamEvent.class)
private List<StreamEvent> events = new ArrayList<>();
....
}
and JobRun entity:
#Entity
#Table(name = "jobs_run")
#JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "id")
#IdClass(JobRunKey.class)
public class JobRun implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
#Id
#Column(name = "id")
private Long id;
#Id
#Column(name = "run_id", insertable = false, updatable = false)
private Long runId;
#Column(name = "name")
private String name;
#Column(name = "type")
private String jobType;
#Column(name = "script")
private String script;
#Column(name = "status")
private Integer status;
#ManyToOne
#JoinColumns({ #JoinColumn(name = "run_id", referencedColumnName = "run_id"), #JoinColumn(name = "job_stream_id", referencedColumnName = "id") })
private StreamRun stream;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "jobRun", orphanRemoval = true, targetEntity = JobDependencyRun.class)
public List<JobDependencyRun> dependencies = new ArrayList<>();
#OneToMany(cascade = CascadeType.ALL, mappedBy = "jobRun", orphanRemoval = true, targetEntity = JobEvent.class)
public List<JobEvent> events = new ArrayList<>();
....
}
And all the columns are defined in the MySQL database, Table job_run have composite key of (id and run_id).
The problem is in JobRun entity:
If I define "run_id" field as #ID then an exception appear (when insert)
Parameter index out of range (8 > number of parameters, which is 7).
If I define it without #ID then an exception appear (when update)
Duplicate entry '4-78' for key 'PRIMARY'
If I remove the whole field definition from entity since it is foreign key then the exception will be:
Unable to find column with logical name run_id
"Although the column exists in the table".
Please, can anyone help me?
Do I do anything wrong in the code?
I have managed to find a solution, by modifying JobRun entity as below, and change\access the value of runId from direct setter and getter method.
#Entity
#Table(name = "jobs_run")
#JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "id")
#IdClass(JobRunKey.class)
public class JobRun implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#Column(name = "id")
private Long id;
#Id
#Column(name = "run_id")
private Long runId;
#Column(name = "job_stream_id")
private Long streamId;
#Column(name = "name")
private String name;
#Column(name = "type")
private String jobType;
#Column(name = "script")
private String script;
#Column(name = "status")
private Integer status;
#ManyToOne
#JoinColumns({ #JoinColumn(name = "run_id", referencedColumnName = "run_id", insertable = false, updatable = false),
#JoinColumn(name = "job_stream_id", referencedColumnName = "id", insertable = false, updatable = false) })
private StreamRun stream;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "jobRun", orphanRemoval = true, targetEntity = JobDependencyRun.class)
public List<JobDependencyRun> dependencies = new ArrayList<>();
#OneToMany(cascade = CascadeType.ALL, mappedBy = "jobRun", orphanRemoval = true, targetEntity = JobEvent.class)
public List<JobEvent> events = new ArrayList<>();
...
}
Related
I have the following code for many to many or many to one relationship persistence using Spring JPA.
This is my repository test https://github.com/Truebu/testJpa.git
This class has three one-to-many relationships, but none work well
#Entity(name = "routine_assignament")
#Table(name = "routine_assignament")
public class RoutineAssignament {
#Id
#GeneratedValue(strategy = IDENTITY)
#Column(name = "id", updatable = false)
private Long id;
#Column(name = "date_start",nullable = true,columnDefinition = "DATE")
private Date date_start = new Date();
#Column(name = "date_end",nullable = true,columnDefinition = "DATE")
private Date date_end;
#ManyToOne
#JoinColumn(name = "id_user")
private User user;
#ManyToOne
#JoinColumn(name = "id_routine")
private Routine routine;
#OneToMany(mappedBy = "routine_assignament")
private Set<Score> scores = new HashSet<>();
#OneToMany(mappedBy = "routine_assignament")
private Set<Statistic> statistics = new HashSet<>();
#OneToMany(mappedBy = "routine_assignament")
private Set<KeepRoutine> keepRoutines = new HashSet<>();
The other classes
#Entity(name = "score")
#Table(name = "score")
public class Score {
#Id
#GeneratedValue(strategy = IDENTITY)
#Column(name = "id", updatable = false)
private Long id;
#Column(name = "commentary",nullable = false,columnDefinition = "TEXT", unique = true)
private String commentary;
#Column(name = "assessment",nullable = false,columnDefinition = "INT", unique = true)
private String assessment;
#ManyToOne
#JoinColumn(name = "id_routine_assignament")
private RoutineAssignament routineAssignament;
}
#Entity(name = "statistic")
#Table(name = "statistic")
public class Statistic {
#Id
#GeneratedValue(strategy = IDENTITY)
#Column(name = "id", updatable = false)
private Long id;
#Column(name = "time",nullable = false,columnDefinition = "TEXT", unique = true)
private String time;
#ManyToOne
#JoinColumn(name = "id_routine_assignament")
private RoutineAssignament routineAssignament;
}
and
#Entity(name = "keep_routine")
#Table(name = "keep_routine")
public class KeepRoutine {
#Id
#GeneratedValue(strategy = IDENTITY)
#Column(name = "id", updatable = false)
private Long id;
#ManyToOne
#JoinColumn(name = "id_routine_assignament")
private RoutineAssignament routineAssignament;
}
The entity relationship diagram is this:
My mistake is that it doesn't detect these relationships correctly.
When I run it it generates this:
Failed to initialize JPA EntityManagerFactory: mappedBy reference an unknown target entity property: com.example.demo.model.entities.KeepRoutine.routine_assignament in com.example.demo.model.entities.RoutineAssignament.keepRoutines
This error is reproduced with all three classes (KeepRoutine, Statistic and Score), I don't know why
Your OneToMany mapping is not appropriate. You need to use routineAssignament the property name instead of the table name routine_assignament as shown below. This property name is defined in the ManyToOne relationship.
#OneToMany(mappedBy = "routineAssignament")
private Set<Score> scores = new HashSet<>();
#OneToMany(mappedBy = "routineAssignament")
private Set<Statistic> statistics = new HashSet<>();
#OneToMany(mappedBy = "routineAssignament")
private Set<KeepRoutine> keepRoutines = new HashSet<>();
i have a weird issue : i'am trying to save a User in my DB, this user has a list of skills. those skills are already in the db with linked categories and categories have linked domains. the structure looks like this :
when i print the list of skills from the applicant i have this :
skills=[Skill{categories=[Category{domains=[Domain{id=4, name=DevOps}], id=13, name=BackEnd}], id=23, name=Java}, Skill{categories=[Category{domains=[Domain{id=4, name=DevOps}], id=13, name=BackEnd}], id=24, name=C}],
and here is the table making the link between Applicant and skills :
but when i'm trying to save the applicant i have this Détail : Failing row contains (23, null, null, 499). can someone explain me ? I'm working on a spring application using jpa annotaions.
EDIT 1 :
ApplicantEntity :
#Entity
#Table(name = "ATS_APPLICANT")
public class ApplicantEntity implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
#Column(name = "home", unique = false, nullable = true)
private Boolean home;
#Column(name = "anonymous", unique = false, nullable = true)
private Boolean anonymous;
#Enumerated(EnumType.STRING)
#Column(name = "job_type")
private JobType jobType;
#Column(name = "min_salary", unique = false, nullable = true)
private Integer minSalary;
#OneToOne(cascade = CascadeType.ALL)
#JoinColumn(unique = true)
private UserEntity user;
#OneToMany(targetEntity = ApplicantWorkExperienceEntity.class, cascade = CascadeType.ALL)
private List<ApplicantWorkExperienceEntity> applicantWorkExperiences = new ArrayList<ApplicantWorkExperienceEntity>();
#ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
#JoinTable(name = "ATS_APPLICANT_SKILL", joinColumns = #JoinColumn(name = "applicant_id", referencedColumnName = "id"), inverseJoinColumns = #JoinColumn(name = "skill_id", referencedColumnName = "id"))
private List<SkillEntity> skills = new ArrayList<SkillEntity>();
#ManyToMany(cascade = CascadeType.ALL)
#JoinTable(name = "ATS_APPLICANT_LOCATION", joinColumns = #JoinColumn(name = "applicant_id", referencedColumnName = "id"), inverseJoinColumns = #JoinColumn(name = "location_id", referencedColumnName = "id"))
private List<LocationEntity> locations = new ArrayList<LocationEntity>();
SkillEntity :
#Entity
#Table(name = "ATS_SKILL")
public class SkillEntity implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
#NotNull
#Size(min = 1, max = 42)
#Column(name = "name", length = 42, nullable = false, unique = true)
private String name;
#ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
#JoinTable(name = "ATS_SKILL_CATEGORY", joinColumns = #JoinColumn(name = "skill_id", referencedColumnName = "id"), inverseJoinColumns = #JoinColumn(name = "category_id", referencedColumnName = "id"))
private List<CategoryEntity> categories = new ArrayList<CategoryEntity>();
CategoryEntity :
#Entity
#Table(name = "ATS_CATEGORY")
public class CategoryEntity implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
#NotNull
#Size(min = 1, max = 42)
#Column(name = "name", length = 42, nullable = false, unique = true)
private String name;
#ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
#JoinTable(name = "ATS_CATEGORY_DOMAIN", joinColumns = #JoinColumn(name = "category_id", referencedColumnName = "id"), inverseJoinColumns = #JoinColumn(name = "domain_id", referencedColumnName = "id"))
private List<DomainEntity> domains = new ArrayList<DomainEntity>();
EDIT 2 :
DomainEntity :
#Entity
#Table(name = "ATS_DOMAIN")
public class DomainEntity implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
#NotNull
#Size(min = 1, max = 42)
#Column(name = "name", length = 42, nullable = false, unique = true)
private String name;
I succeed by using #ElementCollection annotation on skills.
Does anyone know how to fix the mapping of entities?
Error is
Caused by: org.hibernate.AnnotationException: Column name ID of
com.test.TableAa not found in JoinColumns.referencedColumnName.
TableAa entity
#Entity
#Table(name = "TABLE_AA")
public class TableAa {
#EmbeddedId
private TableAaPk pk;
#Column(name = "FIRST_NAME")
private String first_name;
#Column(name = "LAST_NAME")
private String last_name;
//#OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
//#JoinColumns({
//#JoinColumn(name = "ID", referencedColumnName = "ID", insertable = false, updatable = false),
//#JoinColumn(name = "ACCOUNT_NUMBER", referencedColumnName = "ACCOUNT_NUMBER", insertable = false, updatable = false) })
#OneToMany(mappedBy = "tableAa", cascade = CascadeType.ALL)
private List<TableBb> tableBbList;
}
TableAaPk composite key
#Embeddable
public class TableAaPk implements Serializable{
private static final long serialVersionUID = 1L;
#Column(name="ID")
private String id;
#Column(name="ACCOUNT_NUMBER")
private String accountNumber;
}
TableBb entity
#Entity
#Table(name = "TABLE_BB")
public class TableBb {
#EmbeddedId
private TableBbPk pk;
#Column(name = "FIRST_NAME")
private String first_name;
#Column(name = "LAST_NAME")
private String last_name;
}
TableBbPk composite key
#Embeddable
public class TableBbPk implements Serializable{
private static final long serialVersionUID = 1L;
#Column(name="ID")
private String id;
#Column(name="ACCOUNT_NUMBER")
private String accountNumber;
#Column(name="CODE")
private String code;
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumns({
#JoinColumn(name = "ID", referencedColumnName = "ID", insertable = false, updatable = false),
#JoinColumn(name = "ACCOUNT_NUMBER", referencedColumnName = "ACCOUNT_NUMBER", insertable = false, updatable = false) })
private TableAa tableAa;
}
In your TAbleAa you should have your OneToMany mapping as follows:
#OneToMany(mappedBy = "pk.tableAa", cascade = CascadeType.ALL)
private List<TableBb> tableBbList;
You reference through the embeddable which name is pk.
I think your problem in this entity
#Entity
#Table(name = "TABLE_BB")
public class TableBb {
#EmbeddedId
private TableBbPk pk;
#Column(name = "FIRST_NAME")
private String first_name;
#Column(name = "LAST_NAME")
private String last_name;
// I think the solution is to add the relation #ManyToOne which mapped by in the other side
#ManyToOne // because u refere to this name (tableAa) in #OneToMany(mappedBy = "tableAa"...) in TableAa entity
private TableAa tableAa;
}
I have a spring data rest api for the backend and AngularJs for the front end (mysql as the DB).
I'm trying to add a list of "dictamenes" to an "expediente" using the repositories I made the following JAVA logic
Mixed Java Class ExpedienteDictamen:
#Entity
#Table(name="expediente_dictamen")
public class ExpedienteDictamen implements Serializable{
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue
#Column(name = "id")
private Long id;
#RestResource(exported=false)
#ManyToOne(fetch = FetchType.EAGER, targetEntity = Expediente.class, optional=false, cascade=CascadeType.MERGE)
#JoinColumns(value = {
#JoinColumn(name = "expediente", referencedColumnName = "id", insertable = true, updatable = true, nullable = true)})
private Expediente expediente;
#RestResource(exported=false)
#ManyToOne(fetch = FetchType.EAGER, targetEntity = Dictamen.class, optional=false, cascade=CascadeType.MERGE)
#JoinColumns(value = {
#JoinColumn(name = "dictamen", referencedColumnName = "id", insertable = true, updatable = true, nullable = true)})
private Dictamen dictamen;
#Column(name = "fecha_carga")
private Date fechaCarga;
#Column(name = "fecha_mod")
private Date fechaMod;
#Column(name = "usuario_carga")
private String usuarioCarga;
#Column(name = "usuario_mod")
private String usuarioMod;
Expediente:
#Entity
#Table(name = "expediente")
public class Expediente implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue
#Column(name = "id")
private Long id;
#Column(name = "numero_expediente")
private String numeroExpediente;
#Column(name = "acta_recepcion")
private String actaRecepcion;
#Column(name = "acta_aceptacion")
private String actaAceptacion;
#Column(name = "cartilla_medica")
private String cartillaMedica;
#Column(name = "cartilla_medica_obs")
private String cartillaMedicaObs;
#Column(name = "medico_acepta")
private String medicoAcepta;
#Column(name = "cartilla_notificacion")
private String cartillaNotificacion;
#RestResource(exported=false)
#ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST})
#JoinColumn(name = "solicitud", referencedColumnName = "id")
private Solicitud solicitud;
#RestResource(exported=false)
#ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST})
#JoinColumn(name = "franquicia", referencedColumnName = "id")
private Franquicia franquicia;
#RestResource(exported=false)
#ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST})
#JoinColumn(name = "disposicion", referencedColumnName = "id")
private Disposicion disposicion;
#RestResource(exported=false)
#ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST})
#JoinColumn(name = "paso", referencedColumnName = "id")
private Paso paso;
#OrderBy(value="dictamen")
#RestResource(exported=false)
#OneToMany(fetch = FetchType.EAGER, mappedBy = "expediente", cascade=CascadeType.ALL)
private Set<ExpedienteDictamen> expedienteDictamen = new HashSet<ExpedienteDictamen>();
#Column(name = "obs_documentacion")
private String obsDocumetacion;
#Column(name = "documentacion")
private Boolean documentacion;
#Column(name = "juntamedica")
private Boolean juntamedica;
#Column(name = "visa_rehabilitacion")
private Boolean visaRehabilitacion;
#Column(name = "visa_dos")
private Boolean visaDos;
#Column(name = "mesa_entradas")
private Boolean mesaEntradas;
#Column(name = "direccion_nacional")
private Boolean direccionNacional;
#Column(name = "finalizado")
private Boolean finalizado;
#Column(name = "fecha_carga")
private Date fechaCarga;
#Column(name = "fecha_mod")
private Date fechaMod;
#Column(name = "usuario_carga")
private String usuarioCarga;
#Column(name = "usuario_mod")
private String usuarioMod;
Dictamen:
#Entity
#Table(name = "dictamen")
public class Dictamen implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue
#Column(name = "id")
private Long id;
#Column(name = "dictamen")
private String dictamen;
#Column(name = "fecha_dictamen")
private Date fechaDictamen;
#Column(name = "numero_dictamen")
private String numeroDictamen;
So far everything but saving a ExpedienteDictamen seems to be working fine.
The repos are standard ones using JpaRepository.
When I post to a existing "ExpedienteDictamen" everything works fine, but when I try to create a new one it says this:
Query is: insert into expediente_dictamen (fecha_carga, fecha_mod, usuario_carga, usuario_mod) values (?, ?, ?, ?)
Query is:
insert into expediente_dictamen (fecha_carga, fecha_mod, usuario_carga, usuario_mod) values (?, ?, ?, ?)
2016-08-30 16:17:01.792 DEBUG 30635 --- [nio-8080-exec-5] a.g.s.f.aop.logging.LoggingAspect : Enter: ar.gob.snr.franquicia.web.rest.errors.ExceptionTranslator.processRuntimeException() with argument[s] = [org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement]
2016-08-30 16:17:01.792 DEBUG 30635 --- [nio-8080-exec-5] a.g.s.f.aop.logging.LoggingAspect : Exit: ar.gob.snr.franquicia.web.rest.errors.ExceptionTranslator.processRuntimeException() with result = <500 Internal Server Error,ar.gob.snr.franquicia.web.rest.errors.ErrorDTO#6a850e14,{}>
Any Ideas?
**Edited.
How are u creating ExpedienteDictamen without expediente and dictamen values since those are not nullable?
Since these properties also have insertable and updatable as false, records of ExpedienteDictamen could be created using Expediente/Dictamen entities
I'm starting with hibernate and I having some difficulties to build a easy
relationship of tables
, hibernate throw nested exception is org.hibernate.MappingException: Unable to find column with logical name: USERNAME in org.hibernate.mapping.Table(USER_FILESYSTEM) and its related supertables and secondary tables
I have this model
USER--1---N-->USER_FILE_SYSTEM--1--N-->USER_FS_THUMBS
All column name on DB squema are OK the column username" exists on table USER_FILESYSTEM
and table user
Table Users
#Entity
#Table(name = "USERS")
public class Users implements Serializable {
#Id
#Column(name = "USERNAME", nullable = false, length = 15)
private String username;
#Column(name = "PASSWORD", nullable = false, length = 64)
private String password;
#Column(name = "FIRSTNAME", length = 32)
private String firstname;
#Column(name = "LASTNAME", length = 32)
private String lastname;
#Column(name = "EMAIL", nullable = false, length = 60)
private String email;
#Column(name = "TELEPHONE", length = 50)
private String telephone;
#OneToOne(cascade = CascadeType.ALL)
#JoinTable(name = "USER_ROLE",
joinColumns = {
#JoinColumn(name = "USERNAME_ID", referencedColumnName = "USERNAME")},
inverseJoinColumns = {
#JoinColumn(name = "ROL_ID", referencedColumnName = "ROL")}
)
private Rol role;
#OneToMany(
fetch = FetchType.EAGER, mappedBy = "username"
)
private Set<UserFileSystem> fileSystem;
Table UserFileSystem
#Entity
#Table(name = "USER_FILESYSTEM")
public class UserFileSystem implements Serializable {
#Id
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumn(name = "USERNAME", nullable = false)
private Users username;
#Id
#Column(name = "SERVICE_ID", nullable = false, length = 10)
#GeneratedValue(strategy = GenerationType.AUTO)
private Integer serviceId;
#Id
#Column(name = "SERVICE_FOLDER", nullable = false, length = 64)
private String serviceFolder;
#Column(name = "PROTOCOL", length = 20)
private String protocol;
#Column(name = "PARAMS", length = 512)
private String params;
#OneToMany(
fetch = FetchType.LAZY, mappedBy = "userFileSystemThumbsPK"
)
private Set<UserFileSystemThumbs> fileSystemThumbs;
Table UserFileSystemThumbs
#Entity
#Table(name = "USER_FS_THUMBS")
public class UserFileSystemThumbs implements Serializable {
#EmbeddedId
private UserFileSystemThumbsPK userFileSystemThumbsPK;
#Column(name = "SERVICE_URL", nullable = false)
private String serviceUrl;
#Column(name = "CONTENT", nullable = false)
private byte[] content;
#Column(name = "MIME_TYPE", nullable = false)
private String mimeType;
Primary key entity UserFileSystemThumbs
#Embeddable
public class UserFileSystemThumbsPK implements Serializable {
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumns({
#JoinColumn(name = "USERNAME", nullable = false, referencedColumnName = "USERNAME"),
#JoinColumn(name = "SERVICE_ID", nullable = false, referencedColumnName = "SERVICE_ID")
})
private UserFileSystem userFileSystem;
#Column(name = "SERVICE_URL_HASH", nullable = false)
private String serviceUrlHash;
Constructor equals hash....
the problem I think that UserFileSystemThumbsPK USERNAME column do reference to UserFileSystem but in this table the column USERNAME is provided by users.
Solution by OP.
I changed
#Entity
#Table(name = "USER_FILESYSTEM")
public class UserFileSystem implements Serializable {
#Id
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumn(name = "USERNAME", nullable = false)
private Users username;
#Id
#Column(name = "SERVICE_ID", nullable = false, length = 10)
#GeneratedValue(strategy = GenerationType.AUTO)
private Integer serviceId;
}
for this
#Entity
#Table(name = "USER_FILESYSTEM")
public class UserFileSystem implements Serializable {
#EmbeddedId
private UserFileSystemID userFSID;
}
and I created the object UserFileSystemID with 2 values of PK
It's working like a champ!