About FetchType

manual

Retrieving JPA Entity Objects

Explains how to use JPA to retrieve entity objects from the database.... fetched. See JavaDoc Reference Page... = FetchType javax.persistence.FetchType JPA enum Defines strategies for fetching data from the ...

 
api-jpa

javax.persistence.FetchType

Defines strategies for fetching data from the database.(Enum of JPA)

 
api-jpa

JPA Annotations for Relationships

Reference (JavaDoc) of JPA 2 relationship annotations, including @ManyToMany, @ManyToOne, @OneToMany, @OneToOne, @OrderBy and @MapKey.... javax.persistence.CascadeType javax.persistence.FetchType Additional annotations are supported by ObjectDB for ...

 
issue

New entity objects are duplicated on merge cascading

When merge is cascaded to a new entity object that has not been persisted yet - it becomes persisted twice. This was demonstrated by a Java EE application in this forum thread but may be reproduced also in a simple console test case: ... = CascadeType . ALL , fetch = FetchType . EAGER ) private List<Chapter> ... @ OneToOne ( fetch = FetchType . LAZY , cascade = CascadeType . ALL ) ...

 
forum_thread

Problem with @Basic(fetch = FetchType.LAZY)

I have a class where two fields are annotated with @Basic(fetch = FetchType.LAZY) due to them containing quite long Strings and me loading ALL entities of the database on application startup (swing app) This class should hopefully demonstrate the problem: ... where two fields are annotated with  @Basic(fetch = FetchType.LAZY) due to them containing quite long Strings and me loading ALL ... ; @ Basic ( fetch = FetchType . LAZY ) private String description ; @ ...

 
forum_thread

find() cost unreasonable time!

Hi, I make a full binary tree of 4095 node, I check the first 9 node, but the root cost 24 seconds, why? Result: ... ( mappedBy = "parent" , fetch = FetchType . EAGER ) protected List<Nodes> Sons ; ... . Entity ; import javax. persistence . FetchType ; import javax. persistence . GeneratedValue ; ...

 
api-jpa

values()

Returns an array containing the constants of this enum type.(Static Method of javax.persistence.FetchType)

 
forum_thread

Should derived fields of an EmbeddedId be manually maintained by app code?

If I have an Entity which has a primary key which is derived and I am implementing it using @EmbeddedId, am I responsible for maintaining the derived fields of the @EmbeddedId? I could not find anything in the JPA 2.0 spec http://download.oracle.com/auth/otn-pub/jcp/persistence-2.0-fr-oth-JSpec/persistence-2_0-final-spec.pdf?e=1317047713&h=54831c176e81a244a4c309e13eba0b27 which tells me what to expect. ... ; import javax. persistence . FetchType ; import javax. persistence . ManyToOne ; ...   @ ManyToOne ( fetch = FetchType . LAZY ) @ MapsId ( "cont" ) ...

 
forum_thread

Removing an entity throws exception

Hi all, I'm testing ObjectDB for my project, but I have troubles with it. At this time I'm not able to remove customer entity, when it's read by a query (it's attached), it throws this exception: Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: com.objectdb.o._RollbackException: Failed to commit transaction: 51 ... ... = CascadeType . ALL , fetch = FetchType . EAGER , optional = false , ... mappedBy = "customer" , fetch = FetchType . LAZY ) private List<Item> itemList ; ... mappedBy = "customer" , fetch = FetchType . LAZY ) private List<OtherItem> ...

 
forum_thread

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

In the code example below (also attached) I would like to understand why I am able to print to console a lazy @OneToMany mapped field after a finding entity manager closes. There is a switch DO_VIEW_BEFORE_CLOSE, and when it is true the fields are accessed and output before the finding entity manager closes and as expected both a mapped @OneToMany list and an unmapped @OneToMany list are viewable: a.listA_mapped:[{A}[4]"ownedElement1", {A}[5]"ownedElement2"] a.listB_unmapped:[{B}[2]"b1", {B}[3]"b2"] ... @ ManyToOne ( fetch = FetchType . LAZY , cascade = CascadeType . ALL ) ... @ OneToMany ( fetch = FetchType . LAZY , mappedBy = "a" , cascade = ...