Internal Website Search

1-50 of 136 results

Detached Entity Objects

. Cascading Detach Marking a reference field with CascadeType . DETACH (or CascadeType ... field): @Entity class Employee { : @OneToOne ( cascade = CascadeType . DETACH ) private Address address ... an instance of Address , which is another entity class. Due to the CascadeType .DETACH setting

Deleting JPA Entity Objects

the database require an active transaction. Cascading Remove Marking a reference field with CascadeType . REMOVE (or CascadeType . ALL , which includes REMOVE ) indicates that remove operations ... = CascadeType . REMOVE ) private Address address; : } In the example above, the Employee entity class contains

javax.persistence.CascadeType

JPA Enum CascadeType java.lang.Object ∟  java.lang.Enum ∟  javax.persistence. CascadeType ... Static Enum Methods: CascadeType [] values () Returns an array containing the constants of this enum type ... : for ( CascadeType c : CascadeType .values()) System.out.println(c); Return: an array containing

javax.persistence.CascadeType.DETACH

JPA Enum Constant in javax.persistence. CascadeType DETACH Cascade detach operation Since: JPA 2.0

javax.persistence.CascadeType.REFRESH

JPA Enum Constant in javax.persistence. CascadeType REFRESH Cascade refresh operation Since: JPA 1.0

javax.persistence.CascadeType.PERSIST

JPA Enum Constant in javax.persistence. CascadeType PERSIST Cascade persist operation Since: JPA 1.0

javax.persistence.CascadeType.ALL

JPA Enum Constant in javax.persistence. CascadeType ALL Cascade all operations Since: JPA 1.0

javax.persistence.CascadeType.REMOVE

JPA Enum Constant in javax.persistence. CascadeType REMOVE Cascade remove operation Since: JPA 1.0

javax.persistence.CascadeType.MERGE

JPA Enum Constant in javax.persistence. CascadeType MERGE Cascade merge operation Since: JPA 1.0

orphanRemoval = true not working when CascadeType.REMOVE is disabled

= CascadeType .REMOVE) Address entities used Employee (id=1) deleted, but Address (name_2) using

Storing JPA Entity Objects

field with CascadeType . PERSIST (or CascadeType . ALL  that also covers PERSIST ) indicates ... { : @OneToOne ( cascade = CascadeType . PERSIST ) private Address address; : } In the example ... , which is another entity class. Due to the CascadeType .PERSIST  setting, when an Employee instance

Retrieving JPA Entity Objects

an EntityNotFoundException is thrown. Cascading Refresh Marking a reference field with CascadeType . REFRESH (or CascadeType . ALL , which includes REFRESH ) indicates that refresh operations should be cascaded ... can be referenced by a collection field): @Entity class Employee { : @OneToOne ( cascade = CascadeType

Updating JPA Entity Objects

by fields that are marked with CascadeType . PERSIST or CascadeType . ALL are also persisted

JPA Entity Fields

{ @Basic ( optional =false) Integer field1; @OneToOne ( cascade = CascadeType . ALL ) MyEntity field2

EntityManager.refresh takes a long time

relationsto itself with a cascade refresh: @OneToMany(mappedBy = "person", cascade = CascadeType .ALL) private List openIdAuths = new ArrayList (); @OneToMany(mappedBy = "person", cascade = CascadeType .ALL) private List operations = new ArrayList (); @ManyToMany(cascade = CascadeType .REFRESH) @NotNull

Persist error @ManyToMany how to define correct entities relationships

; @ManyToMany(cascade= CascadeType .PERSIST) private List categories = new ArrayList(); } @Entity public class ... . CascadeType ; import javax.persistence.Entity; import javax.persistence.EntityManager; import javax ... implements Serializable { @Id //@GeneratedValue private long id; @ManyToMany(cascade= CascadeType .PERSIST

persisting object with long[][] arrays of array

(); Here is the object: import java.io.Serializable; import javax.persistence. CascadeType ; import javax ... ;  @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType .ALL) public long[] time;     @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType .ALL) private long[][] a1;   

How to Remove records from many to many relationship tables in JPA

public class TransportationEvent { ... @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType ... { .... @ManyToMany( fetch = FetchType.LAZY, cascade = CascadeType .PERSIST) private List transportationEvents ... .annotations. CascadeType .DELETE_ORPHAN) and i applied that as @ManyToMany(fetch = FetchType.EAGER, cascade

Merge Issue: Attempt to reuse an existing primary key value

;        CascadeType .ALL         ... ? ( without retrieving child on Db or using other tricks ). Thanks, Xirt Edit : Using CascadeType .MERGE make the test case working ! I think the CascadeType .PERSIST ( included in CascadeType .ALL ) is the problem. In

ManyToMany Set is null

={ CascadeType . DETACH , CascadeType . MERGE , CascadeType . REFRESH }) @JoinTable(name="PERSON_CONTRACT ... = FetchType. EAGER , cascade={ CascadeType . DETACH , CascadeType . MERGE , CascadeType . REFRESH }, mappedBy

Is it possible to remove parent/child entities without refresh?

.persistence. CascadeType ; import javax.persistence.Column; import javax.persistence.Entity; import javax ... ;   @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType .ALL, mappedBy = "parent ... , cascade = { CascadeType .PERSIST, CascadeType .MERGE, CascadeType .REFRESH })   private ParentEntity

Merge with Parent/Child entities not possible

.util.Map; import javax.persistence. CascadeType ; import javax.persistence.Column; import javax ... , cascade = CascadeType .ALL, mappedBy = "parent", orphanRemoval = true)   @MapKey(name = "childName ... long id;   @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType .PERSIST, CascadeType .MERGE

EntityManager JPA or JDO impl and different behavior

; @OneToMany(cascade= CascadeType .PERSIST, fetch=FetchType.EAGER)         ... ;     }         @OneToMany(cascade= CascadeType ... to the map value." This appears to mean that if I have cascade= CascadeType .ALL on a OneToMany map

EM.find() is suddenly slower

= { CascadeType .REFRESH, CascadeType .DETACH }) private ModelElementImpl element; @OneToMany (fetch = FetchType.EAGER, cascade = { CascadeType .REFRESH, CascadeType .DETACH }) private HashMap mappingMap = new

Embedded Entity in EmbeddedId not persisted. Error 631 at select.

; em.getTransaction().commit(); or by specifying CascadeType .PERSIST: @Embeddable public static class AId {     @OneToOne(cascade = CascadeType .PERSIST)     public B b; Apparently the @Embedded annotation works as  CascadeType .PERSIST , although B

Left join fetch behaviour doesn't retrieve children?

(i guess ?). import java.util.HashSet; import java.util.Set; import javax.persistence. CascadeType ... = MyEntityChild.class, cascade = CascadeType .ALL)         public ... . CascadeType ; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToOne

Fields in objects not populated in query result.

= CascadeType .ALL) private Map children = new TreeMap (); private String path;      [assorted ... id; private String name; private String description; @ManyToOne(cascade= CascadeType .PERSIST) private Folder parent; private boolean listable; @ManyToMany(cascade= CascadeType .ALL) private Map

@OneToMany(fetch = FetchType.LAZY) list is always null

, generator = "b") private int id; @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType ... Parent { // ...id @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType .ALL) private ByteData bydaData ... = GenerationType.AUTO) private int id; @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType .ALL) private OTO

Mapped (Inverse) LAZY @OneToMany vs. Unmapped LAZY @OneToMany

;     @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType .ALL)    ... ; @OneToMany(fetch = FetchType.LAZY, mappedBy = "a", cascade = CascadeType .ALL)     ... = FetchType.LAZY, cascade = CascadeType .ALL)         List listB

Is it ok to put list or map of embeddable objects in entity ?

Serializable { (...) @OneToMany(cascade = CascadeType .ALL) List entityCList; } Where EntityC is some ... to have removed all EntityB classes also (which are part of EmbeddableB with CascadeType .ALL). And that's not ... ;@OneToMany(cascade = CascadeType .ALL)     List embeddableBList; } It is not

Mysterious "Attempt to persist a reference to a non managed instance" error

javax.persistence. CascadeType .*; import static javax.persistence.FetchType.*; @Entity public class ... @ManyToMany(cascade = { CascadeType .ALL}, targetEntity = Passenger.class, mappedBy = "buses")   private Set passengers= new HashSet();   Passenger.class @ManyToMany(cascade = { CascadeType

Apparent Lazy Loading issues.

element apply to the map value." This appears to mean that if I have cascade= CascadeType ... to have CascadeType .ALL. The test created the AttributeNames via the dao prior to trying to persist. The list ... about trying to reuse a primary key for AttributeName. So I removed the CascadeType .All from Holder

Double persist of Entity field with Cascade.ALL

I am building a JavaEE application using Netbeans 7.0.1, Glassfish 3.1 and ObjectDB 2.3.3. I have a Book class with entity field Chapter which has a CascadeType .ALL property. The Book fields are as ... bookTitle; @OneToMany(cascade= CascadeType .ALL, fetch= FetchType.EAGER) private List chapters; The Chapter

Multiple Collection Fields not update correctly

to another entity and they both reciprocally do: EntityB:     @OneToOne(cascade = CascadeType ... = CascadeType .ALL)     EntityB entityB;   If I make only one of the cascade, then this bug

Optimistic locking: prevent version increment on entity collection attribute

", cascade= CascadeType .PERSIST)     private List readings = new ArrayList ... = 0; @Id private long id = ID_SEQ++; @OneToMany(mappedBy="document", cascade= CascadeType .PERSIST

javax.persistence.ManyToMany

; } See Also: JoinTable Since: JPA 1.0 Public Annotation Attributes CascadeType [] cascade default {} (Optional

javax.persistence.OneToOne.cascade

JPA Annotation Attribute in javax.persistence.OneToOne CascadeType [] cascade default {} (Optional) The operations that must be cascaded to the target of the association. By default no operations are cascaded. Since: JPA 1.0

javax.persistence.OneToOne

Annotation Attributes CascadeType [] cascade default {} (Optional) The operations that must be cascaded

javax.persistence.OneToMany

.0 Public Annotation Attributes CascadeType [] cascade default {} (Optional) The operations

javax.persistence.OneToMany.cascade

JPA Annotation Attribute in javax.persistence.OneToMany CascadeType [] cascade default {} (Optional) The operations that must be cascaded to the target of the association. Defaults to no operations being cascaded. When the target collection is a java.util.Map , the cascade element applies to the map value. Since: JPA 1.0

javax.persistence.ManyToMany.cascade

JPA Annotation Attribute in javax.persistence.ManyToMany CascadeType [] cascade default {} (Optional) The operations that must be cascaded to the target of the association. When the target collection is a java.util.Map , the cascade element applies to the map value. Defaults to no operations being cascaded. Since: JPA 1.0

javax.persistence.ManyToOne.cascade

JPA Annotation Attribute in javax.persistence.ManyToOne CascadeType [] cascade default {} (Optional) The operations that must be cascaded to the target of the association. By default no operations are cascaded. Since: JPA 1.0

javax.persistence.ManyToOne

.pm") Collection manages; } Since: JPA 1.0 Public Annotation Attributes CascadeType [] cascade

Tracking changes to new collections (in enhancement mode) after flush

= "uid") private String uid; @OneToOne (fetch = FetchType.EAGER, cascade = { CascadeType .REFRESH, CascadeType .DETACH }) private ModelElementImpl element; @OneToMany (fetch = FetchType.EAGER, cascade = { CascadeType .REFRESH, CascadeType .DETACH }) private HashMap mappingMap = new HashMap (1); (edited

After using the enhancer, Lazy loaded collections are no longer loading. They are set as null

; } @Override public void setId(Long id) { this.id = id; } @OneToMany(cascade={ CascadeType .MERGE, CascadeType .PERSIST}, mappedBy="account", fetch = FetchType.LAZY) @JoinColumn(name = "project_id", unique=true ... ; @OneToMany(cascade={ CascadeType .MERGE, CascadeType .PERSIST},        

NullPointerException when using multithreading

private String secondId; @OneToOne(cascade= CascadeType .ALL) private HashMap myMap; } @Embeddable public class EmbeddableA { @OneToOne(cascade= CascadeType .ALL) private HashMap myMap; } @Embeddable public class EmbeddableB { @OneToOne(cascade= CascadeType .ALL) private HashMap myMap; } I'm am trying

Best practise loading big data

.persistence . Basic ; import javax.persistence . CascadeType ; import javax.persistence ... ; @OneToMany (cascade = CascadeType . ALL , targetEntity = MyStepBlock . class , fetch = FetchType ... (cascade = CascadeType . ALL , targetEntity = MyStep . class , fetch = FetchType . LAZY ) ArrayList steps

New entity objects are duplicated on merge cascading

;       @OneToMany(cascade= CascadeType .ALL, fetch= FetchType.EAGER ... ;    @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType .ALL)     ... ;  @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType .ALL)      

ClassCastException after upgrade to 2.3.5_03

, cascade= CascadeType .ALL, fetch=FetchType.EAGER) private Object payload; @OneToOne(orphanRemoval=true, cascade= CascadeType .ALL, fetch=FetchType.EAGER) private Map metadata; ... In this case the "payload

Remove of an entry from a @OneToMany collection is not possible if the enhancer is disabled

. CascadeType ; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence ... {   @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType .ALL, orphanRemoval = true)