Hibernate : #OneToMany : Always deleting and reinserting the child records - hibernate-mapping

Please help me resolve this issue. I tried googling for a solution and couldn't find one for this.
Table structure
Table: Catalog
catalog_id (primary key)
name
Table: Catalog_Locale
catalog_id
locale_id
sequence
composite key(catalog_id,locale_id)
Class
public Class Catalog{
#Id
#Column(name = "CATALOG_ID", nullable = false)
private String catalogId;
#Column(name = "NAME")
private String name;
#OneToMany(targetEntity = CatalogLocale.class,fetch=FetchType.LAZY)
#JoinColumn(name = "CHILD_CATALOG_ID", nullable = false)
#Cascade(value = {})
protected List<CatalogLocale> locales = new ArrayList<CatalogLocale>(10);
public void setCatalogId( String catalogId ){
this.catalogId = catalogId;
}
public void setName( String name ){
this.name = name;
}
public void setLocales( List<CatalogLocale> locales ){
this.locales = locales;
}
public void getCatalogId(){
return catalogId;
}
public void getName(){
return name;
}
public void getLocales(){
return locales;
}
}
public class CatalogLocale{
#EmbeddedId
CatalogLocalePk catalogLocalePk;
#Column(name = "SEQUENCE")
private int sequence;
public void setCatalogLocalePk( CatalogLocalePk catalogLocalePk ){
this.catalogLocalePk = catalogLocalePk;
}
public void setSequence( int sequence ){
this.sequence = sequence;
}
public CatalogLocalePk getCatalogLocalePk(){
return catalogLocalePk;
}
public int getSequence(){
return sequence;
}
#Embeddable
public static class CatalogLocalePk{
#Column(name = "CATALOG_ID", nullable = false)
private String catalogId;
#Column(name = "LOCALE_ID", nullable = false)
private String localeId;
public CatalogLocalePk(){
}
public CatalogLocalePk( String catalogId, String localeId ){
this.catalogId = catalogId;
this.localeId = localeId;
}
public void setCatalogId( String catalogId ){
this.catalogId = catalogId;
}
public void setLocaleId( String localeId ){
this.localeId = localeId;
}
public String getCatalogId(){
return catalogId;
}
public String getLocaleId(){
return localeId;
}
}
}
The code works for fine for the insert operation, but for any update to the Catalog will trigger for delete and reinsert all entries of the child table.
Is there any solution for this?

Related

#Indexed annotation is ignored

I have a simple Product class as it follows
#SolrDocument(collection = "product")
public class Product {
#Id
#Indexed(name = "id", type = "string")
private String id;
#Field
#Indexed(name = "namex", type = "text_general", stored = false, searchable=true)
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
my problem is that the annotation #Indexed is completely ignored. The name of the field is simply name (instead of namex) and the field is stored. Any guess?
UPDATE 1 if I remove the type annotation name works, but stored has no effect still
I managed by modifying the bean that creates the SolrTemplate object like follows:
#Bean
public SolrTemplate solrTemplate(SolrClient client) throws Exception {
SolrTemplate st = new SolrTemplate(client);
st.setSchemaCreationFeatures(Collections.singletonList(Feature.CREATE_MISSING_FIELDS));
st.afterPropertiesSet();
return st;
}

Room Android : Entities and Pojos must have a usable public constructor

Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type)
Am integrating room into my existing project. While annotating a POJO, which implements Parcelable, with #Entity tag and making necessary changes, am getting this error. I already have an empty constructor in it. Any help would be appreciated.
#Entity(tableName = "Departments")
public class Department implements Parcelable {
#PrimaryKey(autoGenerate = true)
private Integer primaryId;
private Integer id;
private String departmentName;
private String logoUrl;
#Embedded
private ArrayList<Template> templateList;
public Department() {
}
protected Department(Parcel in) {
this.primaryId = (Integer) in.readSerializable();
this.departmentName = in.readString();
this.logoUrl = in.readString();
this.id = (Integer) in.readSerializable();
this.templateList = in.createTypedArrayList(Template.CREATOR);
}
public static final Creator<Department> CREATOR = new Creator<Department>() {
#Override
public Department createFromParcel(Parcel in) {
return new Department(in);
}
#Override
public Department[] newArray(int size) {
return new Department[size];
}
};
#Override
public int describeContents() {
return 0;
}
#Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeSerializable(primaryId);
dest.writeString(departmentName);
dest.writeString(logoUrl);
dest.writeSerializable(id);
dest.writeTypedList(templateList);
}
public Integer getPrimaryId() {
return primaryId;
}
public void setPrimaryId(Integer primaryId) {
this.primaryId = primaryId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLogoUrl() {
return logoUrl;
}
public void setLogoUrl(String logoUrl) {
this.logoUrl = logoUrl;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public ArrayList<Template> getTemplateList() {
return templateList;
}
public void setTemplateList(ArrayList<Template> templateList) {
this.templateList = templateList;
}
}
#Entity(tableName = "Templates")
public class Template implements Parcelable {
#PrimaryKey(autoGenerate = true)
private Integer primaryId;
private Integer id;
private String code;
private String description;
private Integer departmentId;
#Embedded
private ArrayList<Issue> issueList;
public Template() {
}
private Template(Parcel in) {
this.primaryId = (Integer) in.readSerializable();
this.code = in.readString();
this.description = in.readString();
this.id = (Integer) in.readSerializable();
this.departmentId = (Integer) in.readSerializable();
this.issueList = in.createTypedArrayList(Issue.CREATOR);
}
public static final Creator<Template> CREATOR = new Creator<Template>() {
#Override
public Template createFromParcel(Parcel in) {
return new Template(in);
}
#Override
public Template[] newArray(int size) {
return new Template[size];
}
};
#Override
public int describeContents() {
return 0;
}
#Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeSerializable(primaryId);
dest.writeString(code);
dest.writeString(description);
dest.writeSerializable(id);
dest.writeSerializable(departmentId);
dest.writeTypedList(issueList);
}
public Integer getPrimaryId() {
return primaryId;
}
public void setPrimaryId(Integer primaryId) {
this.primaryId = primaryId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public ArrayList<Issue> getIssueList() {
return issueList;
}
public void setIssueList(ArrayList<Issue> issueList) {
this.issueList = issueList;
}
public Integer getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
}
#Entity(tableName = "Issues")
public class Issue implements Parcelable {
#PrimaryKey(autoGenerate = true)
private Integer primaryId;
private Integer id;
private String code;
private String description;
private Integer parentIssue;
public Issue() {
}
protected Issue(Parcel in) {
this.primaryId = (Integer) in.readSerializable();
this.code = in.readString();
this.description = in.readString();
this.id = (Integer) in.readSerializable();
this.parentIssue = (Integer) in.readSerializable();
}
public static final Creator<Issue> CREATOR = new Creator<Issue>() {
#Override
public Issue createFromParcel(Parcel in) {
return new Issue(in);
}
#Override
public Issue[] newArray(int size) {
return new Issue[size];
}
};
#Override
public int describeContents() {
return 0;
}
#Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeSerializable(primaryId);
dest.writeString(code);
dest.writeString(description);
dest.writeSerializable(id);
dest.writeSerializable(parentIssue);
}
public Integer getPrimaryId() {
return primaryId;
}
public void setPrimaryId(Integer primaryId) {
this.primaryId = primaryId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getParentIssue() {
return parentIssue;
}
public void setParentIssue(Integer parentIssue) {
this.parentIssue = parentIssue;
}
}
Room assumes your entity class will be having only one constructor. But there is no such limitations, If you have multiple constructor then annotate one of them with
#Ignore
Room will ignore this constructor and compile without any error.
Example
#Entity(tableName = "Departments")
public class Department implements Parcelable {
#PrimaryKey(autoGenerate = true)
private Integer primaryId;
private Integer id;
private String departmentName;
private String logoUrl;
#Embedded
private ArrayList<Template> templateList;
/**Room will ignore this constructor
**/
#Ignore
public Department() {
}
protected Department(Parcel in) {
this.primaryId = (Integer) in.readSerializable();
this.departmentName = in.readString();
this.logoUrl = in.readString();
this.id = (Integer) in.readSerializable();
this.templateList = in.createTypedArrayList(Template.CREATOR);
}
}
I'm not sure why you are getting your specific constructor error. That said your code will error from embedding the ArrayList. #Embedded is not meant to be used this way. #Embedded allows you to flatten your POJO structure when storing it. Nested POJO properties will appear as if they had been properties on the parent POJO. Using Embedded on a List is the same as asking it to flatten the properties of the ArrayList object and store them, not flatten the list items and store them.
The appropriate measure is to transition into a foreign key, primary key relationship. An alternative solution is to create a new POJO that contains your list of items (ie Templates, with an 's'). This would contain an ArrayList of Template objects. You would then define a converter that converts the POJO to a json/comma seperated list, and stores it in a single column that by default would be called "templates". Here is a link to this approach :
Android room persistent library - TypeConverter error of error: Cannot figure out how to save field to database"
Hope this helps.

How convert this SQL query into JPA criteriaBuilder query?

I have the following Data Base diagram:
And I have the following quite simple SQL query:
SELECT Subject.id, Subject.name, subSelect.count
FROM
(SELECT Subject.id AS id, COUNT(*) AS count
FROM Question
JOIN Subject_Question ON Subject_Question.question_id = Question.id
JOIN Subject ON Subject.id = Subject_Question.subject_id
WHERE Subject.state = 0 AND Question.state = 0
GROUP BY Subject.id) AS subSelect
JOIN Subject ON Subject.id = subSelect.id
My task is to present this query Java application in term of criteriaBuilder from JPA.
This is my domain classes in Java application:
#Entity
#Table(name = "Question")
public class Question {
Long id;
String text;
ActiveUser activeUser;
Long dateCreation;
Long dateStateSetting;
EntityState state;
Set<Subject> subjects;
#Id
#Column(name = "id")
#GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
#Column(name = "text", length = 5000, nullable = false)
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
#ManyToOne(cascade = CascadeType.REMOVE)
#JoinColumn(name = "activeUser", nullable = false)
public ActiveUser getActiveUser() {
return activeUser;
}
public void setActiveUser(ActiveUser activeUser) {
this.activeUser = activeUser;
}
#Column(name = "dateCreation")
public Long getDateCreation() {
return dateCreation;
}
public void setDateCreation(Long dateCreation) {
this.dateCreation = dateCreation;
}
#Column(name = "dateStateSetting")
public Long getDateStateSetting() {
return dateStateSetting;
}
public void setDateStateSetting(Long dateStateSetting) {
this.dateStateSetting = dateStateSetting;
}
#Enumerated(EnumType.ORDINAL)
#Column(name = "state", nullable = false)
public EntityState getState() {
return state;
}
public void setState(EntityState state) {
this.state = state;
}
#ManyToMany(mappedBy = "questions")
public Set<Subject> getSubjects() {
return subjects;
}
public void setSubjects(Set<Subject> subjects) {
this.subjects = subjects;
}
}
And
#Entity
#Table(name = "Subject")
public class Subject {
Long id;
String name;
EntityState state;
Long dateCreation;
Boolean ifGroup;
List<Question> questions;
#Id
#Column(name = "id")
#GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
#Column(name = "name", nullable = false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
#Enumerated(EnumType.ORDINAL)
#Column(name = "state", nullable = false)
public EntityState getState() {
return state;
}
public void setState(EntityState state) {
this.state = state;
}
#Column(name = "dateCreation")
public Long getDateCreation() {
return dateCreation;
}
public void setDateCreation(Long dateCreation) {
this.dateCreation = dateCreation;
}
#Column(name = "ifGroup", nullable = false)
public Boolean getIfGroup() {
return ifGroup;
}
public void setIfGroup(Boolean ifGroup) {
this.ifGroup = ifGroup;
}
#ManyToMany(cascade = CascadeType.REMOVE)
#JoinTable(
name = "Subject_Question",
joinColumns = #JoinColumn(name = "subject_id"),
inverseJoinColumns = #JoinColumn(name = "question_id")
)
public List<Question> getQuestions() {
return questions;
}
public void setQuestions(List<Question> questions) {
this.questions = questions;
}
}
I start with the following:
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Question> criteria = criteriaBuilder.createQuery(Question.class);
Root<Question> i = criteria.from(Question.class);
criteria.multiselect(
i.get("id"),
criteriaBuilder.count(i)).
But at this point I ran into a problem - I must to join with Subject_Question but I don't have class for it in Java application.
So is it possible to represent this SQL query in term of criteriaBuilder from JPA?

JPA OneToMany bidirectional relation [EclipseLink-63] error

Please can you help me? In JPA, I try to create a OneToMany bidirectional relation, but I have the following errors :
"[EclipseLink-63] : The instance creation method [entity.OrderLine.], with no parameters, does not exist, or is not accessible.
[EclipseLink-28019] : Deployment of PersistenceUnit [simple-jpaPU] failed. Close all factories for this PersistenceUnit."
There are my entities :
OneToMany Entity :
package entity;
import java.util.*;
import java.io.Serializable;
import javax.persistence.*;
import org.eclipse.persistence.annotations.TimeOfDay;
#Entity
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
#Temporal(TemporalType.TIMESTAMP)
private Date creationDate;
#OneToMany(mappedBy = "o")
private List<OrderLine> orderLines;
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public List<OrderLine> getOrderLines() {
return orderLines;
}
public void setOrderLines(ArrayList<OrderLine> orderLines) {
this.orderLines = orderLines;
}
public Order(Date creationDate) {
this.creationDate = creationDate;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
#Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
#Override
public String toString() {
return "entity.Order[ id=" + id + " ]";
}
}
ManyToOne Entity :
package entity;
import java.io.Serializable;
import javax.persistence.*;
#Entity
#Table(name="orderline_table")
public class OrderLine implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String item;
private Double unitPrice;
private Integer quantity;
#ManyToOne
Order o;
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public Double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public OrderLine(String item, Double unitPrice, Integer quantity) {
this.item = item;
this.unitPrice = unitPrice;
this.quantity = quantity;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
#Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
#Override
public String toString() {
return "entity.OrderLine[ id=" + id + " ]";
}
}
It fails because OrderLine does not have no-arg constructor. It is required as stated in JPA 2.1 specification (Chapter 2.1):
The entity class must have a no-arg constructor. The entity class may have other constructors as well.The no-arg constructor must be public or protected.
Default constructor is not generated because other constructor is given. Problem can be fixed by adding following constructor:
public OrderLine() {
}

Could not deserialize - POJO file error

Using Netbeans 'Create mapping & POJO files from Database' I am receiving this error:
INFO: HHH000327: Error performing load command : org.hibernate.type.SerializationException: could not deserialize
org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:262)
at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:306)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:155)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:130)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:44)
at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:71)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:263)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:259)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:334)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2969)
at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.loadFromResultSet(EntityReferenceInitializerImpl.java:324)
at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.hydrateEntityState(EntityReferenceInitializerImpl.java:251)
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.readRow(AbstractRowReader.java:107)
at org.hibernate.loader.plan.exec.internal.EntityLoadQueryDetails$EntityLoaderRowReader.readRow(EntityLoadQueryDetails.java:255)
at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:129)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:138)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:102)
at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:186)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4120)
at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:502)
at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:467)
at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:212)
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:145)
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1066)
at org.hibernate.internal.SessionImpl.immediateLoad(SessionImpl.java:972)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:173)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:285)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:185)
at yy.mavenproject2.Bpauser_$$_jvst210_0.getFullName(Bpauser_$$_jvst210_0.java)
at yy.mavenproject2.PP.main(PP.java:29)
Caused by: java.io.StreamCorruptedException: invalid stream header: 786F0607
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:328)
at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:318)
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:237)
... 31 more
And here are PP.java:
package yy.mavenproject2;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import yy.mavenproject2.Bpauser;
public class PP {
public static void main(String[] args) {
Session session = null;
try {
Configuration configuration = new Configuration();
configuration.configure("hibernate.cfg.xml");
StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
SessionFactory sessionFactory = configuration.buildSessionFactory(ssrb.build());
session = sessionFactory.openSession();
if (session.isConnected()) {
String number = "1";
Bpauser emp = (Bpauser) session.load(Bpauser.class, number);
System.out.println("ID is " + emp.getId());
System.out.println("Full Name is " + emp.getFullName());
// System.out.println("E-Mail is " + emp.getEmail());
session.close();
} else {
System.out.println("Connection faiied");
}
} catch (HibernateException e) {
e.printStackTrace();
}
}
}
and Bpauser.java:
package yy.mavenproject2;
// Generated Nov 25, 2015 1:43:19 PM by Hibernate Tools 4.3.1
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
/**
* Bpauser generated by hbm2java
*/
#Entity
#Table(name = "BPAUSER", schema = "BPA", uniqueConstraints = #UniqueConstraint(columnNames = {"USERNAME", "ACTIVE", "DEACTIVATION_DATE"})
)
public class Bpauser implements java.io.Serializable {
private String id;
private long version;
private Bpauser bpauser;
private String password;
private String region;
private String surName;
private String firstName;
private String department;
private String company;
private String country;
private String branch;
private String fullName;
private String username;
private String email;
private String location;
private String displayName;
private boolean active;
private Serializable modified;
private Boolean ignoreInSync;
private Boolean receiveNewTaskEmail;
private BigDecimal cbdSyncVersion;
private Serializable deactivationDate;
private Set bpausers = new HashSet(0);
public Bpauser() {
}
public Bpauser(String id, boolean active) {
this.id = id;
this.active = active;
}
public Bpauser(String id, Bpauser bpauser, String password, String region, String surName, String firstName, String department, String company, String country, String branch, String fullName, String username, String email, String location, String displayName, boolean active, Serializable modified, Boolean ignoreInSync, Boolean receiveNewTaskEmail, BigDecimal cbdSyncVersion, Serializable deactivationDate, Set bpausers) {
this.id = id;
this.bpauser = bpauser;
this.password = password;
this.region = region;
this.surName = surName;
this.firstName = firstName;
this.department = department;
this.company = company;
this.country = country;
this.branch = branch;
this.fullName = fullName;
this.username = username;
this.email = email;
this.location = location;
this.displayName = displayName;
this.active = active;
this.modified = modified;
this.ignoreInSync = ignoreInSync;
this.receiveNewTaskEmail = receiveNewTaskEmail;
this.cbdSyncVersion = cbdSyncVersion;
this.deactivationDate = deactivationDate;
this.bpausers = bpausers;
}
#Id
#Column(name = "ID", unique = true, nullable = false, length = 1020)
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
#Version
#Column(name = "VERSION", nullable = false, precision = 10, scale = 0)
public long getVersion() {
return this.version;
}
public void setVersion(long version) {
this.version = version;
}
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumn(name = "SUPERIOR_USER_ID")
public Bpauser getBpauser() {
return this.bpauser;
}
public void setBpauser(Bpauser bpauser) {
this.bpauser = bpauser;
}
#Column(name = "PASSWORD", length = 400)
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
#Column(name = "REGION", length = 12)
public String getRegion() {
return this.region;
}
public void setRegion(String region) {
this.region = region;
}
#Column(name = "SUR_NAME", length = 200)
public String getSurName() {
return this.surName;
}
public void setSurName(String surName) {
this.surName = surName;
}
#Column(name = "FIRST_NAME", length = 200)
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
#Column(name = "DEPARTMENT", length = 60)
public String getDepartment() {
return this.department;
}
public void setDepartment(String department) {
this.department = department;
}
#Column(name = "COMPANY", length = 200)
public String getCompany() {
return this.company;
}
public void setCompany(String company) {
this.company = company;
}
#Column(name = "COUNTRY", length = 8)
public String getCountry() {
return this.country;
}
public void setCountry(String country) {
this.country = country;
}
#Column(name = "BRANCH", length = 16)
public String getBranch() {
return this.branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
#ManyToOne(fetch = FetchType.LAZY)
#Column(name = "FULL_NAME", length = 400)
public String getFullName() {
return this.fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
#Column(name = "USERNAME", length = 400)
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
#Column(name = "EMAIL", length = 300)
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
#Column(name = "LOCATION", length = 20)
public String getLocation() {
return this.location;
}
public void setLocation(String location) {
this.location = location;
}
#Column(name = "DISPLAY_NAME", length = 400)
public String getDisplayName() {
return this.displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
#Column(name = "ACTIVE", nullable = false, precision = 1, scale = 0)
public boolean isActive() {
return this.active;
}
public void setActive(boolean active) {
this.active = active;
}
#Column(name = "MODIFIED")
public Serializable getModified() {
return this.modified;
}
public void setModified(Serializable modified) {
this.modified = modified;
}
#Column(name = "IGNORE_IN_SYNC", precision = 1, scale = 0)
public Boolean getIgnoreInSync() {
return this.ignoreInSync;
}
public void setIgnoreInSync(Boolean ignoreInSync) {
this.ignoreInSync = ignoreInSync;
}
#Column(name = "RECEIVE_NEW_TASK_EMAIL", precision = 1, scale = 0)
public Boolean getReceiveNewTaskEmail() {
return this.receiveNewTaskEmail;
}
public void setReceiveNewTaskEmail(Boolean receiveNewTaskEmail) {
this.receiveNewTaskEmail = receiveNewTaskEmail;
}
#Column(name = "CBD_SYNC_VERSION", scale = 0)
public BigDecimal getCbdSyncVersion() {
return this.cbdSyncVersion;
}
public void setCbdSyncVersion(BigDecimal cbdSyncVersion) {
this.cbdSyncVersion = cbdSyncVersion;
}
#Column(name = "DEACTIVATION_DATE")
public Serializable getDeactivationDate() {
return this.deactivationDate;
}
public void setDeactivationDate(Serializable deactivationDate) {
this.deactivationDate = deactivationDate;
}
#OneToMany(fetch = FetchType.LAZY, mappedBy = "bpauser")
public Set getBpausers() {
return this.bpausers;
}
public void setBpausers(Set bpausers) {
this.bpausers = bpausers;
}
}
Could you please assist? I can't find why I have the error related to getter getFullName(). Any comments will be very useful.
OK I found the problem myself. DB has type timestamp(6), I had serialized type of variables with those timestamps. So I changed in POJO this serialized type to Date. Solved.