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!