-->
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.  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Reverse MySQL5 -> *.hbm.xml, no reations
PostPosted: Wed Oct 12, 2005 4:48 pm 
Newbie

Joined: Fri Feb 20, 2004 1:39 pm
Posts: 16
Location: Norway
Hi i am seaching all over the place but i cant find the answer..

I try to use Hibernate Tools to make my mapping files from my MySQL5beta (InnoDB).
It seems to works and my mapping files are valid, but it does not seem to see my relations in the db. So basically all i get is the "atom objects" and i need to handcraft the relationships.. (witch is ok, just a little boring with all the tables i have :P )

Is there some support missing, or am i doing something wrong?

I use Eclipse 3.1, hibernate tools 3.1 alfa 5. MySQL driver 3.2 alfa.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 12, 2005 8:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Well your search likely found that this problem always appears to popup in relation to MySQL (early versions). I have not tested version 5 but areas that have in the past can be case of the tables/field, InnoDB tables required and the usual suspect is a incomplete/buggy JDBC driver (being beta its not a surprise). Its the JDBC driver that provides the information as the Meta data facilties are used. You can code a simple test to verify.


Top
 Profile  
 
 Post subject: Reverse MySQL5 -> *.hbm.xml, no relations
PostPosted: Thu Oct 13, 2005 10:37 am 
Newbie

Joined: Fri Feb 20, 2004 1:39 pm
Posts: 16
Location: Norway
Thanks for the quick feedback :)

I'm not too familiar with writing MetaData sql's but i did some simple testing. With getImportedKeys() and getExportedKeys().

Here are the result on the format: "ROPERTY : value"

To me it seems like it deliver the info..
Are there anything spesific i need to test for?

**** DatabaseMetaData.getExportedKeys() ****
PKTABLE_NAME : customer
PKCOLUMN_NAME : id
PK_NAME : null
FKTABLE_NAME : contact
FKCOLUMN_NAME : customer_id
FK_NAME : contact_ibfk_1

PKTABLE_NAME : customer
PKCOLUMN_NAME : id
PK_NAME : null
FKTABLE_NAME : customer_email_address
FKCOLUMN_NAME : customer_id
FK_NAME : customer_email_address_ibfk_1

PKTABLE_NAME : customer
PKCOLUMN_NAME : id
PK_NAME : null
FKTABLE_NAME : customer_mail_address
FKCOLUMN_NAME : customer_id
FK_NAME : customer_mail_address_ibfk_1

PKTABLE_NAME : customer
PKCOLUMN_NAME : id
PK_NAME : null
FKTABLE_NAME : dedup_hash
FKCOLUMN_NAME : customer_id
FK_NAME : dedup_hash_ibfk_2


**** DatabaseMetaData.getImportedKeys() ****
PKTABLE_NAME : country_codes
PKCOLUMN_NAME : iso_2
PK_NAME : null
FKTABLE_NAME : customer
FKCOLUMN_NAME : country
FK_NAME : customer_ibfk_1

PKTABLE_NAME : client
PKCOLUMN_NAME : id
PK_NAME : null
FKTABLE_NAME : customer
FKCOLUMN_NAME : client_id
FK_NAME : FK_customer_client

-Erik


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 11:16 am 
Newbie

Joined: Fri Feb 20, 2004 1:39 pm
Posts: 16
Location: Norway
Just come to think of something..
Is it posible that it is restricted in the Hibernate MySQLInnoDB dialect settings or something..?
The new version got a lot more thing's it support i think.

-Erik


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 11:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no the dialect does not limit reveng.

i have tested with mysql and it seem to works fine...are you sure the right version of the driver is being picked up ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 11:44 am 
Newbie

Joined: Fri Feb 20, 2004 1:39 pm
Posts: 16
Location: Norway
I need to test that a little more (any easy way to get the version info?)
(On another computer at the moment, killing some time)

Just currious.. what versions/tech.stack. did you use that worked?

-Erik


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 11:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the latest at the time...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 7:36 pm 
Newbie

Joined: Fri Feb 20, 2004 1:39 pm
Posts: 16
Location: Norway
Hmmf,
downloaded and tested the latest jar version i could find..

(i were pretty up to date though)

I still cant get the relations ;(...

Are there some logging or something that can be put on to see what happens?

Erik


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 14, 2005 2:09 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes read the docs about hibernate logging in the eclipse help (should be there)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 7:44 pm 
Newbie

Joined: Fri Feb 20, 2004 1:39 pm
Posts: 16
Location: Norway
Hmm, i updated to Tools beta version and turned on logging..

This is some of what it tells me;

!ENTRY org.hibernate.eclipse 1 10000 2005-10-21 01:17:02.254
!MESSAGE DEBUG ModalContext org.hibernate.cfg.JDBCBinder - primary key for org.hibernate.mapping.Table(status_codes) -> org.hibernate.mapping.PrimaryKey(status_codes[org.hibernate.mapping.Column(id)]) as PRIMARY

!ENTRY org.hibernate.eclipse 1 10000 2005-10-21 01:17:02.284
!MESSAGE DEBUG ModalContext org.hibernate.cfg.JDBCBinder - Calling getExportedKeys on org.hibernate.mapping.Table(audit)

!ENTRY org.hibernate.eclipse 1 10000 2005-10-21 01:17:02.394
!MESSAGE DEBUG ModalContext org.hibernate.cfg.JDBCBinder - foreign key name: FK_audit_detail_audit

!ENTRY org.hibernate.eclipse 1 10000 2005-10-21 01:17:02.394
!MESSAGE DEBUG ModalContext org.hibernate.cfg.JDBCBinder - Foreign key FK_audit_detail_audit references unknown or filtered table audit_detail

!ENTRY org.hibernate.eclipse 1 10000 2005-10-21 01:17:02.454
!MESSAGE DEBUG ModalContext org.hibernate.cfg.JDBCBinder - Calling getExportedKeys on org.hibernate.mapping.Table(audit_detail)

!ENTRY org.hibernate.eclipse 1 10000 2005-10-21 01:17:02.555
!MESSAGE DEBUG ModalContext org.hibernate.cfg.JDBCBinder - Calling getExportedKeys on org.hibernate.mapping.Table(client)

!ENTRY org.hibernate.eclipse 1 10000 2005-10-21 01:17:02.665
!MESSAGE DEBUG ModalContext org.hibernate.cfg.JDBCBinder - foreign key name: client_partner_ibfk_1

!ENTRY org.hibernate.eclipse 1 10000 2005-10-21 01:17:02.695
!MESSAGE DEBUG ModalContext org.hibernate.cfg.JDBCBinder - Foreign key client_partner_ibfk_1 references unknown or filtered table client_partner


Anything i am doing wrong?

-Erik


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 4:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Hi,

it seems like it has not picked up classes with the name audit_detail and client_partner.

Have you excluded them ?

If not, please show more of the log - especially the part before this foreign key binding where it will find tables.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 7:27 am 
Newbie

Joined: Fri Feb 20, 2004 1:39 pm
Posts: 16
Location: Norway
Sorry i'm not sure i understand.

Do i need to have a class to do this? I though this is what the tool is for.
Since it did not work 100%. i though at least i could try to generate the
*.hbm.xml files.

The only thing i do spesify is the Console Config, output dir, Reverse e. JDBC, package and Generate mappings (hbm.xml)

Did i miss anything?

-Erik


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 7:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no i dont think so. but for some reason the tool is finding foreign keys pointing to tables that it did not pick up when it scanned for tables.

could you show me the complete log instead of just the snippet you posted ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 7:44 am 
Newbie

Joined: Fri Feb 20, 2004 1:39 pm
Posts: 16
Location: Norway
I think this should be it..

http://www.perspektiver.net/div/hibernate_info.log


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 7:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ok thanks.

I think it might have something to do with whatever schema/catalog mysql is reporting back when I ask for foreign keys.

unfortunately the logs doesnt include that info (i have added it in cvs).

please add it to jira as a bugreport - if possible with the DDL used to create this schema.

And please make sure you don't by accident is using a reveng.xml that exludes everything or only includes parts;)

btw. your log contains user/pwd info which you might want to remove ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ]  Go to page 1, 2  Next

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.