embeddable

Bulk insertion of CollectionTable elements in Hibernate / JPA

和自甴很熟 提交于 2021-02-10 09:45:44
问题 We are using Hibernate 4.2 as the backing library for JPA 2.0 entities. We have an entity like the following: @Entity public class MyEntity { .... @ElementCollection @MapKeyColumn(name = "key") @Column(name = "value") @CollectionTable("MyEntityMap") private Map<String, Integer> theMap; ... } The map potentially has thousands of entries. I have set hibernate.jdbc.batch_size=50 , but Hibernate still generates an insert statement for each entry in the map, when I say entityManager.persist

Bulk insertion of CollectionTable elements in Hibernate / JPA

梦想的初衷 提交于 2021-02-10 09:45:31
问题 We are using Hibernate 4.2 as the backing library for JPA 2.0 entities. We have an entity like the following: @Entity public class MyEntity { .... @ElementCollection @MapKeyColumn(name = "key") @Column(name = "value") @CollectionTable("MyEntityMap") private Map<String, Integer> theMap; ... } The map potentially has thousands of entries. I have set hibernate.jdbc.batch_size=50 , but Hibernate still generates an insert statement for each entry in the map, when I say entityManager.persist

Hibernate Embedded/Embeddable not null exception

£可爱£侵袭症+ 提交于 2020-12-30 06:43:13
问题 In the owning class: ... @Embedded private LatLon location; ... In the referenced class: @Embeddable public class LatLon implements Serializable { private double lat; private double lon; ... } When I try to save an instance of the owning class with a null value for LatLon : org.hibernate.PropertyValueException: not-null property references a null or transient value: com.*.location . What can I do to allow this value to be null in the owning class? I have tried making it Nullable and that had

Hibernate Embedded/Embeddable not null exception

眉间皱痕 提交于 2020-12-30 06:41:35
问题 In the owning class: ... @Embedded private LatLon location; ... In the referenced class: @Embeddable public class LatLon implements Serializable { private double lat; private double lon; ... } When I try to save an instance of the owning class with a null value for LatLon : org.hibernate.PropertyValueException: not-null property references a null or transient value: com.*.location . What can I do to allow this value to be null in the owning class? I have tried making it Nullable and that had

Foreign key mapping inside Embeddable class

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 03:42:37
问题 I am using eclipselink for JPA . I have an entity, which has a composite key fabricated out of two fields. Following is my Embeddable primary key class' fields(members). @Embeddable public class LeavePK { @ManyToOne(optional = false) @JoinColumn(name = "staffId", nullable = false) private Staff staff; @Temporal(TemporalType.TIMESTAMP) private Calendar date; //setters and getters } My entity is going to hold leave data related to a staff, so I am trying to combine staff object and leave date

spring jpa embeddable class send int instead of Object

拜拜、爱过 提交于 2019-12-12 03:25:14
问题 I have a little problem between my RestController response and my AngularJs Controller. First, I'm calling my rest webservice with $http : myModule.controller('UserDetailsCtrl',function($http, idUser){ var self = this; $http.post('/get-user-details', idUser).then( function(response){ self.clients = response.data.usersClients; for(client of self.clients){ console.log("pkUsersClients : " + client.pkUsersClients); // console display "[object Object]" console.log("client : " + client

hibernate h2 embeddable list expected “identifier”

纵饮孤独 提交于 2019-12-10 13:14:20
问题 I'm trying to associate a list of function (whom Embeddable) within my Employee Entity and H2 seems unhappy with this saying that it expected an "identifier" Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement " CREATE TABLE EMPLOYEE_FUNCTIONS ( EMPLOYEE_EMPLOYEEID VARCHAR(255) NOT NULL, ACTIVE BOOLEAN NOT NULL, DEPARTMENTNUMBER INTEGER NOT NULL, DESCRIPTION VARCHAR(255), ORDER[*] INTEGER NOT NULL ) "; expected "identifier"; The thing is I already done that with an other

JPA: Query an embeddable List inside an entity

假如想象 提交于 2019-12-10 10:08:08
问题 I am trying to "extract" Embeddable classes based on some criterias from a list in an Entity. Either with the help of JPQL or Criteria API. I am not a pro at this, so please help me out. Been googling for 4 hours solid for an answer without any results. These are the classes: @Entity public class PostOffice { @Id private Long id; @ElementCollection(fetch=FetchType.LAZY) @CollectionTable(joinColumns=@JoinColumn(name = "CARRIERID")) private List<PostalCarrier> carriers; } @Embeddable public

Nullable embedded value object with not nullable fields

≯℡__Kan透↙ 提交于 2019-12-09 07:31:39
问题 I created an entity "Person" in Doctrine2, and I added to it an Adress entity, which is a value object (embeddable). I want to allow a Person creation, without an Address, so I tag my embedded as "nullable = true". But on the other hand, my Address entity, if it exists, SHOULD contains at least some information (like city, zip code, etc...). So it has "nullable = false" attributes. Address: type: embeddable fields: [...] city: type: string length: 255 nullable: false Person: type: entity

Hibernate NullPointer on INSERTED id when persisting three levels using @Embeddable and cascade

前提是你 提交于 2019-12-08 13:44:48
问题 I cannot cascade merge with persist three levels of entities using @EmbeddedId in the last entity. I have three following entities: 1. Voucher 2. Rate 3. RatePerChannelOverwrite The Voucher is fetched by a service. Then I want to add new Rate to the voucher. Then I want to add new RatePerChannelOverwrite to the Rate . So both Rate and RatePerChannelOverwrite will have their @Id as NULL. This is working. However later I tried to split RatePerChannelOverwrite into two classes and have: