-->
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: Auto Generated Mapping's Have A Catalog Attribute
PostPosted: Mon Apr 23, 2007 11:58 pm 
Newbie

Joined: Mon Apr 23, 2007 11:01 pm
Posts: 4
I am new to Hibernate, so please forgive me if I am not providing the right information in the right amount.

I am using the automatic reverse engineering feature of hibernate's tools to generate mappings and DOA's. However the mappings all contain a line like the following:

<hibernate-mapping>
<class name="somePackage.DoaClassName" table="tableName" catalog="yyXXyy">

I am wondering why yyXXyy is being put in for the catalog name and how I can control it. My database is MySQL using InnoDB. And as far as I know MySql does not support catalogs.

With this attribute set Hibernate will execute SQL like the following:

INSERT INTO yyXXyy.yyXXyy.tableName (col, col, col) values( val, val, val);

which errors quite nicely since it isn't proper syntax.

Note: it is worth mentioning that my user name and schema are the same string.

If I manually enter each mapping file in my class path, to not use catalog="yyXXyy then Hibernate will generate the correct SQL:

INSERT INTO yyXXyy.tableName (col, col, col) values( val, val, val);


I would preferably like to know:

1) Where this attribute is being fulled from (i.e. which cfg file)?
2) How can I turn it off or make this attribute an empty string?
3) If I am using a schema match filter of * (all) is there a setting that will propagate to all tables in the schema?


Top
 Profile  
 
 Post subject: Re: Auto Generated Mapping's Have A Catalog Attribute
PostPosted: Tue Apr 24, 2007 2:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
RaegX wrote:
1) Where this attribute is being fulled from (i.e. which cfg file)?


It is coming from your database when asking it for the catalog and schema for your table.

Quote:
2) How can I turn it off or make this attribute an empty string?


Se default_catalog and default_schema to what you want hibernate tools to consider default (and hence not fill it in for tables that has that value)

Quote:
3) If I am using a schema match filter of * (all) is there a setting that will propagate to all tables in the schema?


see answer to #2

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Auto Generated Mapping's Have A Catalog Attribute
PostPosted: Tue Apr 24, 2007 12:36 pm 
Newbie

Joined: Mon Apr 23, 2007 11:01 pm
Posts: 4
max wrote:
It is coming from your database when asking it for the catalog and schema for your table.


Ok, but MySQL doesn't support catalogs. If it is being pulled from the db, this value shouldn't be possible.

Also I have my default_catalog set to an empty value.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 24, 2007 4:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well mysql reports as they support catalogs via metadata ;)

set default_catalog to the catalog that shows up.

_________________
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.  [ 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.