-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Is there an option to set default cascade values to all?
PostPosted: Thu Jun 21, 2007 12:19 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
Hey,

I want that all my entites will have default cascade.PERSIST.

I am working with JPA.

As i understand there is an option to use in the orm.xml file, but it didnt work.

I look on the web and i find in sun that its not supported in this version.

Is there a workaround for this?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 3:17 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It's supposed to work on Hibernate EntityManager, I think I have a test case for it.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: I tried it and it didnt work for me
PostPosted: Thu Jun 21, 2007 5:02 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
I did default-cascade - persist to the orm.file but it didnt work.

I have another annotation on my classe.


Top
 Profile  
 
 Post subject: Re: I tried it and it didnt work for me
PostPosted: Fri Jun 22, 2007 4:13 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
avihaimar77 wrote:
I have another annotation on my classe.


What do you mean?
Can you post your code and your orm.xml file?

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Attach a sample code
PostPosted: Sun Jun 24, 2007 3:40 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
The orm.xml:

Code:
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation= "http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd" version="1.0">
      <persistence-unit-metadata>
         <persistence-unit-defaults>
            <cascade-persist/>
         </persistence-unit-defaults>
      </persistence-unit-metadata>
</entity-mappings>


If i have the following annotation:

Code:
   @OneToOne(cascade = { CascadeType.REFRESH,
         CascadeType.REMOVE })


The default persist is ignored.

Can i have a strategy of default persist without the need to add it any time i have an annotation of persist?

This is a problem because it can cause problem when developer add a remove annotation and the remove annoattion cause to the persist to stop working.

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 26, 2007 11:38 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
That's a very bad idea since it would be fairly inefficient.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.