I want to get data from my entity with 1-M relationships.
Users have an entity for cv information.With JpaRepo,
Cv class :
#Entity
#Table(name = "cvs")
#Data
#AllArgsConstructor
#NoArgsConstructor
#JsonIgnoreProperties({"hibernateLazyInitializer", "handler", "educations", "works", "langueges", "technologies"})
public class CV {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "id")
private int id;
//ToDo : Employee bilgilerinin görünmesi problemi giderilecek.
#OneToOne
#JoinColumn(name = "employee_id")
private Employee employee;
#OneToMany(mappedBy = "cv", cascade = CascadeType.ALL, orphanRemoval = true)
List<Education> educations;
#OneToMany(mappedBy = "cv", cascade = CascadeType.ALL, orphanRemoval = true)
List<Work> works;
#OneToMany(mappedBy = "cv", cascade = CascadeType.ALL, orphanRemoval = true)
List<Languege> langueges;
#OneToMany(mappedBy = "cv", cascade = CascadeType.ALL, orphanRemoval = true)
List<Technology> technologies;
#Column(name = "github")
private String github;
#Column(name = "linkedin")
private String linkedin;
#NotNull
#NotBlank
#Column(name = "cover_letter")
private String coverLetter;
#Column(name = "photo")
private String photo;
}
This is Education class (work, languege, technology classes same):
#Data
#AllArgsConstructor
#NoArgsConstructor
#Entity
#Table(name = "cv_educations")
public class Education {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "id")
private int id;
#NotNull
#NotBlank
#Column(name = "school_name")
private String schoolName;
#NotNull
#NotBlank
#Column(name = "department")
private String department;
#NotNull
#NotBlank
#PastOrPresent
#Column(name = "starting_date")
#DateTimeFormat(pattern = "yyyy-mm-dd")
private LocalDate startingDate;
#NotBlank
#Column(name = "graduation_date")
#DateTimeFormat(pattern = "yyyy-mm-dd")
private LocalDate graduationDate;
#ManyToOne
#JoinColumn(name = "cv_id")
private CV cv;
}
I tried to build the following structure with jpa, but the constructer takes list parameter. I got an error because I couldn't write it with jpql
public interface CvRepository extends JpaRepository<CV, Integer> {
#Query("select new com.demo.humanresourcesmanagementsystem.Entities.concretes.CV" +
"(employee.firstName, employee.lastName, cv.github, cv.linkedin, cv.coverLetter," +
"educations, works, langueges, technologies)" +
"from CV cv inner join cv.employee employee inner join cv.educations educations " +
"inner join cv.works works inner join cv.langueges langueges " +
"inner join cv.technologies technologies where cv.employee.id =:employeeId")
CV findByCv(int employeeId);
}
I'd like to read about the educations, works, langueges and technologies in this entity. This means that there will be one cv as output, but there may be more than one education object within the cv (such as primary school, high school), and the incoming data will be in the following format, for example:
"firstName": "X",
"lastName" : "X",
"educations" : [
"education1" {
"school" : "x",
"department" : "x" ...},
"education2" {
"school" : "x",
"department" : "x"...}
"works" : [
"work1" {
"workplace" : "x",
"job" : "x" ...
}
]
"github" : "x",
"linkedin" : "x"
How do i set up this structure with the jpa repository? What kind of dto should I write if I'm gonna use it? Thanks.
UPDATE
When i use spring jpa derivered query (findByEmployeeId) i receive data with this format :
{
"success": true,
"message": "string",
"data": {
"id": 0,
"employee": {
"id": 0,
"email": "string",
"password": "string",
"firstName": "string",
"lastName": "string",
"nationalIdentity": "string",
"yearOfBirth": 0
},
"github": "string",
"linkedin": "string",
"coverLetter": "string",
"photo": "string"
}
}
So i cant receive data for education, work, languege and technology.
It seems you're trying to retrieve a CV by its employer.id. In that case, you can really just use the JPA query method containing keywords. In this case it would look like:
CV findByEmployeeId(int employeeId);
This should return the complete CV object as you would expect.
See here for more details on JPA query method keywords.
Related
I have got two entities in my application Orders and Products (one-to-many association). I am aiming to set up a unidirectional OneToMany relationship in Order entity (I'm aware that it is not the best solution, however this is a business requirement). The database schema is generated by Liquibase and validated by Hibernate. Entities have been simplified for the sake of clarity. Database is Postgres.
Although the schema is created correctly, Hibernate throws an exception:
Caused by: org.hibernate.cfg.RecoverableException: Unable to find column with logical name: productId in org.hibernate.mapping.Table(orders) and its related supertables and secondary tables
at org.hibernate.cfg.Ejb3JoinColumn.checkReferencedColumnsType(Ejb3JoinColumn.java:844) ~[hibernate-core-5.6.11.Final.jar:5.6.11.Final]
at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:126) ~[hibernate-core-5.6.11.Final.jar:5.6.11.Final]
at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1740) ~[hibernate-core-5.6.11.Final.jar:5.6.11.Final]
... 37 common frames omitted
Caused by: org.hibernate.MappingException: Unable to find column with logical name: productId in org.hibernate.mapping.Table(orders) and its related supertables and secondary tables
at org.hibernate.cfg.Ejb3JoinColumn.checkReferencedColumnsType(Ejb3JoinColumn.java:839) ~[hibernate-core-5.6.11.Final.jar:5.6.11.Final]
... 39 common frames omitted
To prove that the schema is generated appropriately, I replaced #OneToMany annotation with #ManyToOne and it works fine! All of the sudden, Hibernate is able to find the column. After that I began assuming that there is some kind of bug in Hibernate...
Does anyone have an idea, how to solve this issue?
My code looks as follows:
Order.java
#Entity
#Table(name = "orders")
#Data
#NoArgsConstructor
#AllArgsConstructor
#Builder
public class Order {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long orderId;
#Column
private String clientName;
#OneToMany
#JoinColumn(name = "productIdFK", referencedColumnName = "productId")
private List<Product> productList = new ArrayList<>();
}
Product.java
#Entity
#Table(name = "products")
#Data
#NoArgsConstructor
#AllArgsConstructor
#Builder
public class Product {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long productId;
#Column
private String name;
}
Liquibase script
{
"databaseChangeLog": [
{
"changeSet": {
"id": "Create PRODUCT table",
"author": "me",
"changes": [
{
"createTable": {
"tableName": "products",
"columns": [
{
"column": {
"name": "productId",
"type": "bigint",
"constraints": {
"nullable": false,
"unique": true,
"primaryKey": true
}
}
},
{
"column": {
"name": "name",
"type": "varchar(250)",
"constraints": {
"nullable": true,
"unique": false
}
}
}
]
}
},
{
"createTable": {
"tableName": "orders",
"columns": [
{
"column": {
"name": "orderId",
"type": "bigint",
"constraints": {
"nullable": false,
"unique": true,
"primaryKey": true
}
}
},
{
"column": {
"name": "clientName",
"type": "varchar(250)",
"constraints": {
"nullable": true,
"unique": false
}
}
},
{
"column": {
"name": "productIdFK",
"type": "bigint",
"constraints": {
"nullable": true,
"unique": false
}
}
}
]
}
}
]
}
}
]
}
Snippet from liquibase script generating relationships
{
"addForeignKeyConstraint": {
"constraintName": "fk_product_order",
"baseColumnNames": "productIdFK",
"baseTableName": "orders",
"referencedColumnNames": "productId",
"referencedTableName": "products"
}
}
#OneToMany
#JoinColumn(name = "orderId", referencedColumnName = "productId")// try orderId
private List<Product> productList = new ArrayList<>();
Once you try this
hope this will work out
change to this in Order.java
#OneToMany(cascade = CascadeType.ALL, mappedBy= "order")
private List<Product> productList = new ArrayList<>();
add this in Product.java
#ManyToOne
#JsonIgnore
private Order order;
let me know
You should try this too.
#OneToMany(cascade = CascadeType.ALL, mappedBy = "order")
private List<Product> productList = new ArrayList<>();
along with this in Product.java
#ManyToOne
#JoinColumn(name = "productId",
foreignKey = #ForeignKey(
name = "product_id_fk"))
private Order order;
First, let's clarify what 1 is and what many are at your schema. As Order has a reference to Product that means many Orders might be related to the same Product, mightn't they? A bidirectional relationship is usually preferred but you need the unidirectional one, it should be something like
public class Order {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long orderId;
#Column
private String clientName;
}
and
public class Product {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long productId;
#Column
private String name;
#OneToMany
#JoinColumn(name = "productIdFK", referencedColumnName = "productId")
private List<Order> orderList = new ArrayList<>();
}
I'm just trying to test the relation #ManyTonOne in Spring Boot (Spring Data JPA)n so I've created two simple Class Book and Author
Here is the Class Book and Author :
#Entity
#Table(name = "book")
public class Book {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "id")
private Long id;
#Column(name = "title")
private String title;
#ManyToOne(fetch = FetchType.LAZY, optional = false)
#JoinColumn(name = "author_id", nullable = false)
#JsonIgnore
//#JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
private Author author;
Class Author:
#Entity
#Table(name = "author")
public class Author {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "id")
private Long id;
#Column(name = "fullname")
private String fullame;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "author", fetch = FetchType.LAZY)
private Set<Book> books;
I just want when i try to call findAll() for books i get author also, when i make it by default i get this result without the author :
"_embedded": {
"books": [
{
"title": "Book1",
"_links": {
"self": {
"href": "http://localhost:8080/api/books/1"
},
"book": {
"href": "http://localhost:8080/api/books/1"
}
}
},
Or when i write directly method findAll in controller :
#RestController
public class BookRestController {
#Autowired
BookRepository bookRepo;
#RequestMapping("/books1/")
public List<Book> createInvoice() {
List<Book> list = bookRepo.findAll();
System.out.println(list);
return list;
}
i get this result :
[
{
"id": 1,
"title": "Book1"
},
{
"id": 2,
"title": "Book2"
},
I've tried also to search by title findByTitle(string), I don't get the author also
A different example that I found is about the second relation #OneToMany, not the other way
What I must add in my Entity or repository or controller to retrieve (with a good way) the author id?
I think without the JsonIgnore maybe you're just going right into recursion hell, since the book has an author and the author has minimum this book, and the book has the author...
Try a getter on the AuthorId, something like
public Long getAuthorId() {
return (author == null) ? null : author.getId());
}
EDIT:
wrote the maybe before your comment, now I'm quite sure :-)
Remove #JsonIgnore and use #JsonIdentityInfo on both classes to get author also for every book.
#JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,property = "id")
public class Book {
...
}
#JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,property = "id")
public class Author {
...
}
I have two entities. Customer which is mapped in one to many relation with the CustomerDepartment. CustomerDepartment table has a column to store customer Id.
I want to map them in such a way that Customer Object store a list of Customer Department, and the Customer Department stores the id of the customer it belongs to.
The code that is working compels me to send the all the customer details while creating or updating a customer Department.
Is there a way I can only send the id of the customer and it maps itself?
I have tried changing from -
#JsonBackReference
#ManyToOne
#JoinColumn(name = "customer_no", nullable = false)
private Customer customer;
to this -
#JsonBackReference
#ManyToOne(targetEntity = Customer.class)
#JoinColumn(name = "customer_no", nullable = false)
private Integer customer;
which gives me the requestbody I want but it does not work giving the following error -
2019-08-03 04:59:08 ERROR CustomerController:72 - org.springframework.orm.jpa.JpaSystemException: Error accessing field [private java.lang.Integer com.enquero.pulse.entity.Customer.customerNo] by reflection for persistent property [com.enquero.pulse.entity.Customer#customerNo] : 1; nested exception is org.hibernate.property.access.spi.PropertyAccessException: Error accessing field [private java.lang.Integer com.enquero.pulse.entity.Customer.customerNo] by reflection for persistent property [com.enquero.pulse.entity.Customer#customerNo] : 1
Working Code:
Customer:-
#Data
#NoArgsConstructor
#AllArgsConstructor
#Builder
#DynamicUpdate
#Entity
#Table(name = "customer")
public class Customer extends Auditable<Integer>{
#Id
#Column(name = "customer_no")
private Integer customerNo;
#NotBlank
#Column(name = "customer_name")
private String customerName;
#Column(name = "industry")
private String industry;
#Column(name = "country")
private String country;
#Column(name = "state")
private String state;
#Column(name = "city")
private String city;
#Column(name = "postal_code")
private String postalCode;
#Column(name = "address_line1")
private String addressLine1;
#Column(name = "address_line2")
private String addressLine2;
#Column(name = "address_line3")
private String addressLine3;
#Column(name = "payment_term")
private String paymentTerm;
#Column(name = "customer_segment")
private String customerSegment;
#JsonFormat(pattern="dd-MMM-yyyy")
#Column(name = "engagement_start_on")
private Date engagementStartOn;
#JsonManagedReference
#OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
private List<CustomerDepartment> customerDepartments;
}
CustomerDepartment:-
#Data
#NoArgsConstructor
#AllArgsConstructor
#Builder
#DynamicUpdate
#Entity
#Table(name = "customer_department")
public class CustomerDepartment extends Auditable<Integer>{
#Id
#Column(name = "dept_id", updatable = false, nullable = false)
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer deptId;
#Column(name = "dept_name")
private String deptName;
#Column(name = "primary_contact")
private String primaryContact;
#JsonBackReference
#ManyToOne
#JoinColumn(name = "customer_no", nullable = false)
private Customer customer;
}
Current RequestBody:-
{
"createdBy": 0,
"creationDate": "2019-08-02T23:05:33.993Z",
"customer": {
"addressLine1": "string",
"addressLine2": "string",
"addressLine3": "string",
"city": "string",
"country": "string",
"createdBy": 0,
"creationDate": "2019-08-02T23:05:33.993Z",
"customerDepartments": [
null
],
"customerName": "string",
"customerNo": 0,
"customerSegment": "string",
"engagementStartOn": "string",
"industry": "string",
"lastUpdateDate": "2019-08-02T23:05:33.993Z",
"lastUpdatedBy": 0,
"paymentTerm": "string",
"postalCode": "string",
"state": "string"
},
"deptId": 0,
"deptName": "string",
"lastUpdateDate": "2019-08-02T23:05:33.994Z",
"lastUpdatedBy": 0,
"primaryContact": "string"
}
expected requestbody:-
{
"createdBy": 0,
"creationDate": "2019-08-02T23:05:33.993Z",
"customer": 1, //id instead of json
"deptId": 0,
"deptName": "string",
"lastUpdateDate": "2019-08-02T23:05:33.994Z",
"lastUpdatedBy": 0,
"primaryContact": "string"
}
Have you considered a unidirectional #OneToMany: https://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#associations?
For example on CustomerDeparment change
#JsonBackReference
#ManyToOne
#JoinColumn(name = "customer_no", nullable = false)
private Customer customer;
}
to
#JsonBackReference
#ManyToOne
#Column(name = "customer_no")
private int customer;
...and on Customer change
#JsonManagedReference
#OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
private List<CustomerDepartment> customerDepartments;
}
to
#JsonManagedReference
#OneToMany(cascade = CascadeType.ALL)
private List<CustomerDepartment> customerDepartments;
}
As a bit of an aside, I honestly find Hibernate relationships to sometimes be more a hindrance than a help. As an alternative, you may wish to consider dropping the explicit relationship properties, using "regular" columns (#Column(name="customer_no") private int customer') and just writing queries in your repo classes (ex. findByCustomerNo(int customNumber)) to meet your requirements.
I have created simple CRUD service. With 4 entities: Customer, Provider, Product, Deal.
Customer and Provider entities has composed id AppId with the following structure:
#Getter
#Setter
#Embeddable
#NoArgsConstructor
public class AppId implements Serializable {
private String app;
private String id;
//...
}
Here is business logic I want:
Providers entity cascades and creates Product entities.
When the customer makes deal with provider I need to create entity Deal, which doesn't cascade any other entities.
It just has fields which refer to provider, customer and product of the deal.
I created some providers and customers.
Then I tried to create deal, but I got fields customer and provider null.
Here are my entities definitions:
Provider:
#Entity
#Getter
#Setter
#ToString
#NoArgsConstructor
#Table(name = "provider")
public class Provider implements Serializable {
#EmbeddedId
#Column(name = "appid")
private AppId appId;
#Column(name = "name")
private String name;
#Column(name = "firstname")
private String firstName;
#Column(name = "lastname")
private String lastName;
#Column(name = "latitude")
private float latitude;
#Column(name = "longitude")
private float longitude;
#Column(name = "work_date")
private Date workDate;
#ManyToMany(cascade = CascadeType.ALL)
#JoinTable(name = "provider_product"
, joinColumns = {
#JoinColumn(name = "provider_app"),
#JoinColumn(name = "provider_id")
}
, inverseJoinColumns = #JoinColumn(name="product_id"))
private Set<Product> products;
#OneToMany(cascade = CascadeType.ALL)
#JoinColumns({
#JoinColumn(name = "app", referencedColumnName = "app", updatable = false, insertable = false),
#JoinColumn(name = "id", referencedColumnName = "id", updatable = false, insertable = false)
})
private List<Deal> dealList = new ArrayList<>();
}
Customer:
#Entity
#Getter
#Setter
#ToString
#NoArgsConstructor
#Table(name = "customer")
public class Customer implements Serializable {
#EmbeddedId
#Column(name = "appid")
private AppId appId;
#Column(name = "firstname")
private String firstName;
#Column(name = "lastname")
private String lastName;
public Customer(AppId appId, String firstName, String lastName) {
this.appId = appId;
this.firstName = firstName;
this.lastName = lastName;
}
}
Product:
#Entity
#Getter
#Setter
#ToString
#NoArgsConstructor
#Table(name = "product")
public class Product implements Serializable {
#Id
#GeneratedValue
private long id;
#Column(name = "name")
private String name;
#Column(name = "cost")
private long cost;
}
Deal:
#Entity
#Getter
#Setter
#ToString
#NoArgsConstructor
#Table(name = "deal")
public class Deal implements Serializable {
#Id
#GeneratedValue
private long id;
#ManyToOne
#JoinColumns({
#JoinColumn(name = "provider_app", referencedColumnName = "app", insertable = false, updatable = false),
#JoinColumn(name = "provider_id", referencedColumnName = "id", insertable = false, updatable = false)
})
private Provider provider;
#ManyToOne
#JoinColumns({
#JoinColumn(name = "customer_app", insertable = false, updatable = false),
#JoinColumn(name = "customer_id", insertable = false, updatable = false)
})
private Customer customer;
#ManyToMany
#JoinTable(name = "deal_product"
, joinColumns = #JoinColumn(name="deal_id", insertable = false, updatable = false)
, inverseJoinColumns = #JoinColumn(name="product_id", insertable = false, updatable = false))
private Set<Product> product;
// deal is complete when provider entered deal id
#Column(name = "closed")
private boolean closed = false;
}
By removing insertable = false for customer and provider fields in the Deal entity, everything works fine.
{
"id": 5,
"provider": {
"appId": {
"app": "vk",
"id": "123"
},
"name": null,
"firstName": null,
"lastName": null,
"latitude": 0,
"longitude": 0,
"workDate": null,
"products": null,
"dealList": []
},
"customer": {
"appId": {
"app": "vk",
"id": "123"
},
"firstName": null,
"lastName": null
},
"product": [
{
"id": 2,
"name": "Temp",
"cost": 100
}
],
"closed": false
}
I could get the following response.
insertable = false on a field means when you are saving the entity you won't be saving the value for that field and will set the field explicitly somewhere.
insertable = true doesn't mean you will create a new Customer or Provider, that is handled by CascadeType
I have 2 tables email_address and group_email
I want to get a list of email addresses and if it is group also list the emails of group. Here is my hibernate dom object:
#Entity
#Table(name = "email_address")
public class EmailAddressDom {
#Id
#Column(name = "id")
#GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "email_address_id_seq")
#SequenceGenerator(name = "email_address_id_seq", sequenceName = "email_address_id_seq")
private int id;
#Column(name = "name")
private String name;
#Column(name = "email")
private String email;
#Column(name = "is_group")
private boolean isGroup;
#Column(name = "status")
private boolean status;
// Getters and setters
And here is the implementation how I am getting the list
public List<EmailAddressDom> getEmailAddresses() {
Session session = getCurrentSession();
Criteria criteria = session.createCriteria(EmailAddressDom.class);
List<EmailAddressDom> emailAddresses = criteria.list();
return emailAddresses;
}
And the result is
[
{
"id": 451,
"name": "HS",
"isGroup": true,
"status": true
},
{
"id": 452,
"name": "test4",
"email": "test4#mail.com",
"isGroup": false,
"status": true
},
{
"id": 450,
"name": "test3",
"email": "test3#mail.com",
"isGroup": false,
"status": true
},
{
"id": 402,
"name": "test2",
"email": "test2#mail.com",
"isGroup": false,
"status": true
},
{
"id": 401,
"name": "test1",
"email": "test1#mail.com",
"isGroup": false,
"status": true
}
]
I want to get result like this
[
{
"id":451,
"name":"HS",
"isGroup":true,
"status":true,
"groupEmails":[
{
"id":450,
"name":"test3",
"email":"test3#mail.com",
"isGroup":false,
"status":true
},
{
"id":452,
"name":"test4",
"email":"test4#mail.com",
"isGroup":false,
"status":true
}
]
},
{
"id":402,
"name":"test2",
"email":"test2#mail.com",
"isGroup":false,
"status":true
}
]
Which mapping should I use in EmailAddressDom entity?
Updated accordingly to comments
I have written a simple application mapping following way and it is working fine
#ManyToMany(fetch= FetchType.EAGER, cascade={CascadeType.ALL})
#JoinTable(name="group_email",
joinColumns={#JoinColumn(name="group_id")},
inverseJoinColumns={#JoinColumn(name="email_addr_id")})
private List<EmailAddressDom> groupEmails;
But I have confused setting it in my web application, it throws following exception:
Association has already been visited: AssociationKey(table=group_email, columns={email_addr_id})
What can be the reason?
Either Do Eager loading
#OneToMany(fetch = FetchType.EAGER)
#JoinTable(name = "group_email",
joinColumns = #JoinColumn(name = "email_addr_id", referencedColumnName = "id"),
inverseJoinColumns=#JoinColumn(name="group_id", referencedColumnName="id" ))
private List<EmailAddressDom> emailAddressDoms;
OR
//explicitly join in criteria
public List<EmailAddressDom> getEmailAddresses() {
Session session = getCurrentSession();
Criteria criteria = session.createCriteria(EmailAddressDom.class);
criteria.setFetchMode("emailAddressDoms", fetchMode.JOIN);
List<EmailAddressDom> emailAddresses = criteria.list();
return emailAddresses;
}
To achieve self join, in your EmailAddressDom class add reference to itself like:
#OneToMany(fetch = FetchType.LAZY)
#JoinTable(name = "group_email",
joinColumns = #JoinColumn(name = "email_addr_id", referencedColumnName = "id"),
inverseJoinColumns=#JoinColumn(name="group_id", referencedColumnName="id" ))
private List<EmailAddressDom> emailAddressDoms;
In group_email table you do not require id column as email_addr_id and group_id combination would be unique or do you allow same email more than once in a group?
Update after comment from OP:
To group by email groups, change the mapping like shown below.
#ManyToOne(fetch = FetchType.LAZY)
#JoinTable(name = "group_email",
joinColumns = #JoinColumn(name="group_id", referencedColumnName="id" ),
inverseJoinColumns=#JoinColumn(name = "email_addr_id", referencedColumnName = "id"))
private List<EmailAddressDom> emailAddressDoms;