-->
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.  [ 5 posts ] 
Author Message
 Post subject: Unable to find physical table: `Color`
PostPosted: Wed Feb 23, 2011 9:35 pm 
Newbie

Joined: Wed Feb 23, 2011 9:25 pm
Posts: 12
I have the following declaration
Code:
@Entity()
@Table(name="\"Color\"", schema="\"ColorRepository\"")
public class Color implements Serializable
but when I run my application I keep getting
Code:
Initial SessionFactory creation failed.org.hibernate.MappingException: Unable to find physical table: `Color`
However, looking back at the log is seems that the mapping knows about the PostgreSQL schema
Code:
Ejb3Column - Binding column: Ejb3Column{table=org.hibernate.mapping.Table(ColorRepository.Color)
I can't see anything else obviously wrong. Does anyone have any ideas on what else I can check for?

Cheers, Eric


Top
 Profile  
 
 Post subject: Re: Unable to find physical table: `Color`
PostPosted: Thu Feb 24, 2011 6:40 am 
Regular
Regular

Joined: Fri Jan 28, 2011 11:44 am
Posts: 117
Why do you add a quote inside the table name ?

Code:
@Table(name="\"Color\"", schema="\"ColorRepository\"")


Shouldn't you write ?

Code:
@Table(name="Color", schema="ColorRepository")


Top
 Profile  
 
 Post subject: Re: Unable to find physical table: `Color`
PostPosted: Thu Feb 24, 2011 10:04 am 
Newbie

Joined: Wed Feb 23, 2011 9:25 pm
Posts: 12
The internal quotes are necessary to preserve the mixed-case of the table name, otherwise everything is converted to lower case.

Cheers, Eric


Top
 Profile  
 
 Post subject: Re: Unable to find physical table: `Color`
PostPosted: Thu Feb 24, 2011 5:10 pm 
Newbie

Joined: Wed Feb 23, 2011 9:25 pm
Posts: 12
OK, so if I take the schema strings out of the annotations in source code, and add the following to my hibernate.cfg.xml file
Code:
<property name="default_schema">"ColorRepository"</property>
then everything works fine. However, if instead I try to set the schema on the URL string
Code:
<property name="connection.url">jdbc:postgresql://127.0.0.1:5432/hibernate:currentSchema="ColorRepository";</property>
then it doesn't work. The bottom line is I cannot seem to get my code to work just by specifying the schema in the annotations. I suspect there may be a bug somewhere, maybe in the provider, because I can get some code working by specifying the schema in the annotations, but I cannot get all the code working just using annotations.

I would rather not have to specify the schema in the cfg file as it limits the entire session to just that schema.

Does anyone else have any more clues?

Cheers, Eric


Top
 Profile  
 
 Post subject: Re: Unable to find physical table: `Color`
PostPosted: Thu Feb 24, 2011 6:39 pm 
Newbie

Joined: Wed Feb 23, 2011 9:25 pm
Posts: 12
OK, I reported it as a bug. I have a workaround to use
Code:
@Table(name="\"ColorRepository\".\"Color\"")
Cheers, Eric


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