-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with reverse engineering and cascade strategy
PostPosted: Thu Aug 30, 2012 4:56 pm 
Newbie

Joined: Tue Aug 28, 2012 1:07 pm
Posts: 4
Hi folks,
I'm using:
-PostgreSQL 9.1
-Hibernate 4.1.6
-HibernateTools 3.2.4.GA

The problem that i have is the next. When i generate the clases i always get in many-to-one relations the next annotation
Code:
@OneToMany(fetch = FetchType.LAZY, mappedBy = "contactos")
public Set<Telefonos> getTelefonoses() {
   return this.telefonoses;
}


And i want to get this with hibernate.annotations:
Code:
@OneToMany(fetch = FetchType.LAZY, mappedBy = "contactos")
@Cascade({CascadeType.SAVE_UPDATE})
public Set<Telefonos> getTelefonoses() {
   return this.telefonoses;
}


Searching in the web i found this :
Quote:
Max Rydahl Andersen added a comment - 20/Feb/09 10:16 AM
Ok - I finally managed to get this done.
I did initial work based on your patch (thank you) but quickly realized it was not enough for the full support but I hadn't been able to start without it
I've added a couple of new methods to the Rev.Eng. Strategy:
public AssociationInfo foreignKeyToAssociationInfo(ForeignKey foreignKey);
public AssociationInfo foreignKeyToInverseAssociationInfo(ForeignKey foreignKey);
These returns an AssocationInfo which tells us what value a many-to-one, set or one-to-one or inverse-one-to-one has for cascade, update, insert and fetch.
(I also added foreignKeyToInverseEntityName but that was to fix a side-bug where the naming of one-to-one were not having an effect)
Hope you like it


What is the way to override foreignKeyToAssociationInfo method so i can generate the code and all my many-to-one relations have the @Cascade({CascadeType.SAVE_UPDATE}) annotation

Please Help! My project have over 400 Entitys and i prefer to not do it manually!

thx and sorry for my english!


Top
 Profile  
 
 Post subject: Re: Problem with reverse engineering and cascade strategy
PostPosted: Fri Aug 31, 2012 3:53 pm 
Newbie

Joined: Tue Aug 28, 2012 1:07 pm
Posts: 4
up !


Top
 Profile  
 
 Post subject: Re: Problem with reverse engineering and cascade strategy
PostPosted: Mon Sep 03, 2012 12:03 pm 
Newbie

Joined: Tue Aug 28, 2012 1:07 pm
Posts: 4
up !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.