-->
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: How to mapping table of other database
PostPosted: Wed Apr 12, 2006 8:58 am 
Newbie

Joined: Mon Jan 03, 2005 10:57 pm
Posts: 14
Hi,

I have 2 databases in the some Sybase Install, DBUsers and DBProcess

My problem is, that in the database DBProcess i have onde table "tbProc" that have logic FK with one table of DBUsers.tbuser

ex:

DBUsers:

CREATE TABLE TbUser (
CdUser INT NOT NULL,
NmUser VARCHAR(100) NOT NULL,
PRIMARY KEY(CdUser),
);


DBProcess:
CREATE TABLE TbProc (
CdOperacao INT NOT NULL,
CdUser INT NOT NULL,
NmProcess VARCHAR(100) NOT NULL,
);


In Hibernate mapping i need conf this two tables to be access for the SessionFactory

The connection Pool connecting first in DBUsers :
jdbc:sybase:Tds:10.40.16.20:4500/dbuser

I'm trying mapping tables-objects :

tbuser.hbm.xml
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="vo">

<class name="userVO" table="Tbuser">
<composite-id name="id" class="TbcompradorfinameKey">
<key-property name="cduser" column="CdUser" type="java.lang.Integer"/>
</composite-id>


<property name="nmuser" column="NmUser" type="java.lang.String" not-null="true" />
</class>

</hibernate-mapping>

<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >



tbproc.hbm.xml

<hibernate-mapping package="vo">
<class name="processVO" table="DBProcess..Tbproc">
<composite-id name="id" class="TbcompradorfinameKey">
<key-property name="cdoperacao" column="CdOperacao" type="java.lang.Integer"/>
</composite-id>

<property name="cduser" column="CdUser" type="java.lang.Integer" not-null="true" />
<property name="nmprocess" column="NmProcess" type="java.lang.String" not-null="true" />
</class>

</hibernate-mapping>


But the mapping tbproc.hbm.xml does not work with table="DBProc..Tbproc".

Any one can help me, about how i can mapping table of other database ?


thx

Gustavo


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0
Mapping documents:
tbuser.hbm.xml
tbproc.hbm.xml
Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Sybase 12
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 9:14 am 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
Rather than table="DBProcess..Tbproc" use table="tbproc" schema="dbprocess"

Curtis ...

_________________
---- Don't forget to rate! ----


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 10:14 am 
Newbie

Joined: Mon Jan 03, 2005 10:57 pm
Posts: 14
Schame think that work fine, becouse the sessionfactory start with no error, but when i try run HQL i received this error :

- 010MX: Metadata accessor information was not found on this database. Please install the required tables as mentioned in the jConnect documentation. Error encountered while attempting to retrieve metadata information: com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'use'.


HQL: from processVO o


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 11:21 am 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
You want:

<class name="processVO" table="Tbproc" schema="DBProcess">

Curtis ...

_________________
---- Don't forget to rate! ----


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 12:29 pm 
Newbie

Joined: Mon Jan 03, 2005 10:57 pm
Posts: 14
Curtis,

Thanks for help me.

Im mapping :

<hibernate-mapping package="vo">
<class name="processVO" table="Tbproc" schema="DBProcess">
<composite-id name="id" class="TbcompradorfinameKey">
<key-property name="cdoperacao" column="CdOperacao" type="java.lang.Integer"/>
</composite-id>

<property name="cduser" column="CdUser" type="java.lang.Integer" not-null="true" />
<property name="nmprocess" column="NmProcess" type="java.lang.String" not-null="true" />
</class>

</hibernate-mapping>



And i received this error

- 010MX: Metadata accessor information was not found on this database. Please install the required tables as mentioned in the jConnect documentation. Error encountered while attempting to retrieve metadata information: com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'use'.


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.