-->
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.  [ 4 posts ] 
Author Message
 Post subject: manytomany (one more time, sorry...) and temporal
PostPosted: Thu Aug 16, 2007 7:09 am 
Newbie

Joined: Thu Aug 16, 2007 6:53 am
Posts: 3
Hi,
I tried hibernate tools just to reveng database schema into ejb3 pojos.
I pointed two problems for the moment :

1. when I mapped timestamp into java.util.Calendar, I was unabled to have @Temporal annotation

2. The many-to-many problem, with the loop well known wich lead to bad execution

I try to solve it but not succeed for the moment.

1. For temporal problem, I recompiled beta9 sources with following code in EntityPOJOClass.java :

line 315 :
... else if ("timestamp".equals(typeName) || "java.sql.Timestamp".equals(typeName) || "java.util.Calendar".equals(typeName)) {
buildTemporalAnnotation( annotations, "TIMESTAMP" ); //..the default so don't generate
} ...

which is quit ugly, I agree but I works, so fine.

2. For the manytomany problem, it seems that indicating wich table is reverse would work. But I don't know how to specify this.
In reveng.xml property "invert" for many-to-one doesn't work.
And implementing custom strategy doesn't seem to give access to any helpfull method for such an information.
i'm a bit lost... any idea would be great

(if only i could have a beautyfull "false" for

if ( collection.isInverse() ) {

)

cheers,

thierry


Top
 Profile  
 
 Post subject: Re: manytomany (one more time, sorry...) and temporal
PostPosted: Thu Aug 16, 2007 9:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
tbls wrote:
1. For temporal problem, I recompiled beta9 sources with following code in EntityPOJOClass.java :

line 315 :
... else if ("timestamp".equals(typeName) || "java.sql.Timestamp".equals(typeName) || "java.util.Calendar".equals(typeName)) {
buildTemporalAnnotation( annotations, "TIMESTAMP" ); //..the default so don't generate
} ...

which is quit ugly, I agree but I works, so fine.


I was not aware JPA temporal supported calendar?
Put a patch in jira.

Quote:
2. For the manytomany problem, it seems that indicating wich table is reverse would work. But I don't know how to specify this.
In reveng.xml property "invert" for many-to-one doesn't work.


Quote:
And implementing custom strategy doesn't seem to give access to any helpfull method for such an information.
i'm a bit lost... any idea would be great


From rev.eng.strategy:

/** is the collection inverse or not ? */
public boolean isForeignKeyCollectionInverse(String name, TableIdentifier foreignKeyTable, List columns, TableIdentifier foreignKeyReferencedTable, List referencedColumns);

/** is the collection lazy or not ? */
public boolean isForeignKeyCollectionLazy(String name, TableIdentifier foreignKeyTable, List columns, TableIdentifier foreignKeyReferencedTable, List referencedColumns);

Doesn't that help ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: manytomany (one more time, sorry...) and temporal
PostPosted: Thu Aug 16, 2007 9:44 am 
Newbie

Joined: Thu Aug 16, 2007 6:53 am
Posts: 3
max wrote:
I was not aware JPA temporal supported calendar?
Put a patch in jira.


I've tested and calendar works fine.
I'm not a patch expert, but if there is a procedure somewhere i can try.

max wrote:
From rev.eng.strategy:

/** is the collection inverse or not ? */
public boolean isForeignKeyCollectionInverse(String name, TableIdentifier foreignKeyTable, List columns, TableIdentifier foreignKeyReferencedTable, List referencedColumns);

/** is the collection lazy or not ? */
public boolean isForeignKeyCollectionLazy(String name, TableIdentifier foreignKeyTable, List columns, TableIdentifier foreignKeyReferencedTable, List referencedColumns);

Doesn't that help ?


Sure it helps, haven't seen it.
thx a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 24, 2007 8:32 am 
Newbie

Joined: Thu Aug 16, 2007 6:53 am
Posts: 3
just to signal that for java.util.Date, Temporal Type DATE is not generated too.
With TIMESTAMP for java.util.Calendar it could be a patch, but just you have a procedure to do this ? thx


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.