Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: hibernate.default_schema doesn't work properly
PostPosted: Fri Aug 04, 2017 11:19 am 
Newbie

Joined: Fri Aug 04, 2017 11:09 am
Posts: 2
Hi guys,

I'm trying to set up my hibernate properties. My EAR is running on a wildfly 10.1. In it's standalone.xml I declared my datasource (DB2 Z/os) which I reference in my persistence.xml.
In my persistence.xml I declared <property name="hibernate.default_schema" value="myown"/>. This set up seems to work for some application operations.
That means, if I persist some entities, the sqls are generated correctly and the schema is put in front of the tables name => myown.table.

But for some operations (other tables), the schema isn't put in front of the table - instead the user name. What's the reason?

Thanks a lot,
Christian


Top
 Profile  
 
 Post subject: Re: hibernate.default_schema doesn't work properly
PostPosted: Fri Aug 04, 2017 11:56 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1430
Quote:
But for some operations (other tables), the schema isn't put in front of the table - instead the user name. What's the reason?


Can you elaborate this with some examples: mappings, queries, data access logic?

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: hibernate.default_schema doesn't work properly
PostPosted: Mon Aug 07, 2017 8:19 am 
Newbie

Joined: Thu Aug 03, 2017 4:02 am
Posts: 12
Hi Christian,

I run in missing schema-tags before, when I forgot them in my @JoinTable-Annotation. But as Vlad said before it´s hard to find an answer without examles.

Code:
@Table(name"'EXAMPLE'", schema="myown")
public class example{

@ManyToMany(targetEntity=someEntity.class)
@JoinTable(name?"'SOMENAME'", schema="myown2", .......)
private java.util.Set something = new java.util.HashSet();

}


Kind regards,
Vincent


Top
 Profile  
 
 Post subject: Re: hibernate.default_schema doesn't work properly
PostPosted: Tue Aug 08, 2017 9:03 am 
Newbie

Joined: Fri Aug 04, 2017 11:09 am
Posts: 2
Hey guys,

thanks for your help and interest.

I found the fault. I had a sql query that I put in the entity manager and there, the schema wasn't put in front of the table.
I used the tag {h-schema} so that hibernate uses the default schema from the property

hibernate.default_schema.

Greets,
binke


Top
 Profile  
 
 Post subject: Re: hibernate.default_schema doesn't work properly
PostPosted: Sun Aug 13, 2017 2:16 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1430
For more details about {h-schema}, check out this article.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.