-->
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.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: MySQL Dialect Separator and MySQL Schema
PostPosted: Sun Jul 03, 2005 3:22 am 
Newbie

Joined: Sun Jul 03, 2005 3:16 am
Posts: 8
Hi Hibernate Team. I'm tryng to put some data into a MySQL Table. The Catalog in the hbm.xml file is flex. Schema is not defined. The table is restaurant_category

When trying to insert, I got an error because the insert is trying to use the following table name: flex.flex__restaurant_category

I check and there a couple of issues here. First, the MySQL separator should be "." instead of "_". Second, the code that qualifies the table should be properly modified so it doesn't add the additional delimiter (currently "_") if schema is null.

I can off couse make these changes myself, but we would really like to use a 100% compatible version that we can upgrade or download and I think making these fixes is not something unreasonable to ask.

Please let me know if you have plans to fix this and when I can get a new jar file.

Awesome job you did with this tool.

Best Regards.

Jose Lora
Senior Systems Architect


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 5:50 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A cold drink while you wait, maybe?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 5:55 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
P.S. There is no issue here of course. You either haven't set the right MySQLDialect and/or you have schema="" in your mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 1:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The use of _ as the schema seperator was done ages ago because older versions of MySQL did not have schemas. You can easily work around this by subclassing the dialect if you are using a recent MySQL.


Top
 Profile  
 
 Post subject: No Schema defined on my conf files and the SQL Dialect is ok
PostPosted: Sun Jul 03, 2005 4:27 pm 
Newbie

Joined: Sun Jul 03, 2005 3:16 am
Posts: 8
christian wrote:
P.S. There is no issue here of course. You either haven't set the right MySQLDialect and/or you have schema="" in your mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:33 pm 
Newbie

Joined: Sun Jul 03, 2005 3:16 am
Posts: 8
That I know, any chances this change will made it theu the official version?

Also, if no Schema is defined (as in my case) the table name is not properly generated. The code on org.hibernate.mapping.Table:

if ( catalog != null ) {
qualifiedName.append( catalog );
qualifiedName.append( separator );
qualifiedName.append( schema != null ? schema : "" );
qualifiedName.append( separator );
}

Should be changed to something more like:

if ( catalog != null ) {
qualifiedName.append( catalog );
qualifiedName.append( separator );
qualifiedName.append( schema != null ? schema : "" );
qualifiedName.append( schema != null ? separator : "" );
}


So we don;t get table names with two separators together if catalog is defined and schema is not.

Now, what I'd like is a permanent fix instead of a workaround, I'm not sur eif this forwum is the right place to post these suggestions.

gavin wrote:
The use of _ as the schema seperator was done ages ago because older versions of MySQL did not have schemas. You can easily work around this by subclassing the dialect if you are using a recent MySQL.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:34 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Again, this:

flex.flex__restaurant_category

is impossible, because the code uses the same character to do catalog and schema separation. If you get "." you are not using MySQLDialect (or its subclasses we package). If you want a different character than "_", use your own dialect as Gavin says.


Top
 Profile  
 
 Post subject: Re: No Schema defined on my conf files and the SQL Dialect i
PostPosted: Sun Jul 03, 2005 4:34 pm 
Newbie

Joined: Sun Jul 03, 2005 3:16 am
Posts: 8
Schema is not defined in any of the conf files.

Im using org.hibernate.dialect.MySQLDialect and the latest vrsion of MySQL. Is this correct?

Jose_Lora wrote:
christian wrote:
P.S. There is no issue here of course. You either haven't set the right MySQLDialect and/or you have schema="" in your mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:36 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Use an up-to-date Hibernate version! Next time fill out the required information instead of ignoring it.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:37 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
"Now, what I'd like is a permanent fix instead of a workaround, I'm not sur eif this forwum is the right place to post these suggestions. "

And think about your tone, otherwise the forum is indeed the wrong place for you.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:38 pm 
Newbie

Joined: Sun Jul 03, 2005 3:16 am
Posts: 8
Hi Christina, I've downloaded the latest Production release a couple of days ago. I'll double check if there is something more recent. Why do you think I'm not using the latest version?

christian wrote:
Use an up-to-date Hibernate version! Next time fill out the required information instead of ignoring it.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:39 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hey, why not tell us the version already. This is not a Q/A game.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:39 pm 
Newbie

Joined: Sun Jul 03, 2005 3:16 am
Posts: 8
Sorry Chritsian, that didn't come out well. But you got the idea.

christian wrote:
"Now, what I'd like is a permanent fix instead of a workaround, I'm not sur eif this forwum is the right place to post these suggestions. "

And think about your tone, otherwise the forum is indeed the wrong place for you.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:40 pm 
Newbie

Joined: Sun Jul 03, 2005 3:16 am
Posts: 8
Hibernate 3.0.5

christian wrote:
Hey, why not tell us the version already. This is not a Q/A game.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 4:44 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Code is wrong, open a JIRA case.


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