About cascade

forum_thread

Foreign key constraint issue

Hi, I'm trying to create two tables (Parent and Child) with a foreign key constraint from Child to Parent so that when the parent is deleted all children are removed as well. Unfortunately, in one specific case that foreign key constraint doesn't apply and I can't figure out what I'm missing. The definitions of the classes are as follows: ...     @ManyToOne(optional = false, cascade = {})     @JoinColumn(name="PARENT_ID", nullable = ... private long id;     @OneToMany(cascade = {CascadeType.MERGE, CascadeType.REMOVE}, mappedBy = "parent", ...

 
forum_thread

Lazy loading does not work - crud takes long

tomee7.0.0SNAPSHOT,objectdb 2.6.4 The OneToMany Entities are filled with 40.000 Records and they have between 20-40 Columns. It takes over 50s to load all Project Enities that contains the OneToMany Relationships. It should be load lazy but i didnt know why the query fetch all the Data. ... id ; .. .. @ OneToMany ( cascade = CascadeType . ALL , orphanRemoval = true , ... datapoint ;   @ OneToMany ( cascade = CascadeType . ALL , orphanRemoval = true , ...

 
forum_thread

JPA vs JDO - which is more efficient for OneToMany queries?

I'm curious about the trade offs between JDO and JPA. Seems to me that JDO will perform better and be statically typed. For example: Assume there are Customers and Orders.... 2) You have to persist both unless you have automatic cascade persist. In JDO all fields cascade persist operations automatically. In JPA you have to set it per field ...

 
issue

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

Environment: Mac OS X JVM: Java 1.8 u 20 Steps to reproduce Use the following classes: /** Account Class **/ ... }   @ OneToMany ( cascade = { CascadeType . MERGE , CascadeType . ... 1L ;   @ OneToMany ( cascade = { CascadeType . MERGE , CascadeType . ...

 
forum_thread

Merge on detached entities

Hello, it is possible to merge detached entities? There are some attached entities which load from the database. The transaction is finished and the entities become detached. In a new transaction the fields of the detached entities will be changed and a merge by em.merge(entity) will be saved the entities. Can this works correctly? How are the rules of the merge process? Do the changed fields of the detached entity overwrite the fields in the database? Also changed fields which are set to null? ... - but just because that collection was not yet loaded. The cascade type for this reference was set to ALL. Then we tried to merge that ...

 
forum_thread

Some details about db behavior

Suppose I have two entities... A B -> A B has a ManyToOne relationship with A. When my database is empty and I persist a valid B entity (that contains actual A reference) I observe some behaviour that I'm not sure I understand. ... it. Please explain what is happening there? I know about cascade option, and if I use it A will be persisted under A type... but is B ...

 
issue

objectdb-2.6.9_06: Extended Persistence Context fails: 'Attempt to begin a new transaction when a transaction is active'

objectdb-2.6.9_01 NetBeans8.1+Glassfish4.1.1 Mac OS X Possibly related: How to Use a SF with extended Persistence Context? Test mini web app at: https://www.webel.com.au/downloads/objectdb/GreensoftObjectdbTestWebMini3683.2016-09-29.tgz Bug Version: Priority: Normal Status: Active Replies: 3 Type:  Bug ...

 
forum_thread

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

We have a big object tree in our project. If I use the entityManage.remove method a entityManager.refresh is necessary in order to have an updated object tree in memory. But entityManager.refresh is too slow for our project. Do you know a possibilty to remove parent/child entities without entityManager.refresh after the entityManager.remove operation? I have searched for a solution with the following unit test (See testRemoveVariant2()). But my approach works correctly. Do you have an idea? ... ( fetch = FetchType . LAZY , cascade = CascadeType . ALL , mappedBy = "parent" , ... ( fetch = FetchType . LAZY , cascade = { CascadeType . PERSIST , CascadeType ...

 
release

2.4.1

Release date: 2012-06-16 Download (5.4 MB) Binary:  objectdb-2.4.1.zip You should start by following a  tutorial or reading the manual ...

 
release

2.4.0

Release date: 2012-05-20 Download (5.4 MB) Binary:  objectdb-2.4.0.zip You should start by following a  tutorial or reading the manual ...