Chaudari,
 
 
Have you created the files (see also below):
- database.xml
- mapping.xml
 
Have you generated your value beans (from a xsd schema)?
The source generator needs the following packages:
- xerces (or other xml implemenation) http://xml.apache.org/
- jakarta-regexp  http://jakarta.apache.org/regexp/index.html
 
If all done, compile your application and run your tests.
 
 
Tjeerd
 
 
database.properties
--------------------------------------------------------------------------------
Search and replace the following words:
- databaseAlias    ->  This is the name that will be used by the JDO instance:
                       jdo.setDatabaseName("databaseAlias");
- serverName       ->  Name or ip address of your database server (maybe the
                       port numerb is differned, but the default is 1521 for Oracle)
- theDatabaseName  ->  The name of the database as it is known in Oracle.
- accountId        ->  The username under which you can access the db.
- thePassword      ->  The password.
Using the connection pool is prefered.
--------------------------------------------------------------------------------
<!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version 1.0//EN"
                           "
http://castor.exolab.org/jdo-conf.dtd">
 

<database  name="databaseAlias"  engine="oracle" >
  <!--  ============================================================  -->
  <!--  Oracle single connection                                      -->
  <!--  ============================================================  -->
  <!--
  <driver  class-name = "oracle.jdbc.driver.OracleDriver"
           url        = "jdbc:oracle:thin:@serverName:1521:theDatabaseName">
    <param  name="user"      value="accountId" />
    <param  name="password"  value="thePassword" />
  </driver>
  -->
 
  <!--  ============================================================  -->
  <!--  Oracle connection pool                                        -->
  <!--  ============================================================  -->
  <data-source  class-name="oracle.jdbc.pool.OracleConnectionCacheImpl">
    <params  URL      = "jdbc:oracle:thin:@serverName:1521:theDatabaseName
             user     = "accountId
             password = "thePassword" />
  </data-source>
 
  <!--  ============================================================  -->
  <!--  The path and location of the related mapping file.            -->
  <!--  Relative from the path of this file (I think).                -->
  <!--  ============================================================  -->
  <mapping  href = " "mapping.xml"" />
</database>
--------------------------------------------------------------------------------
 
 
mapping.xml
--------------------------------------------------------------------------------
Search and replace the following words:
- jdoKeyGeneratorName  ->  Give it a proper name.
- org.organisaton.project.MyClass -> The package and class name of the value
                                     bean that should be read from / store in
                                     the database.
- oracleTableName  ->  The name of the db table which should be used.
-
Extra info:
- The tag 'key-generator' has a attibute 'name', which is actually the type of
  key generator.
- The tag 'key-generator' has a attibute 'alias', which is actually the name of
  key generator.
- The attribute 'field' has an attribute 'name', which should contains the name
  of class field / property / attribute. This name will be used as getter /
  setter (getFirstName()/setFirstName()).
- The attribute 'field' has an attribute 'type', should contain the java type
  of the field (setter/getter method).
- The inner tag 'sql' of the tag 'field' contains the record element name
  of the table (colomn name), from which you want to fill it. Example:
  table t_person colomns {person_id, first_name, brith_date}.
 
--------------------------------------------------------------------------------
<!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
                           "http://castor.exolab.org/mapping.dtd">
 

<mapping>
  <!--  ============================================================  -->
  <!--  Key generator(s) are needed if Oracle generates primary key   -->
  <!--  id for new rows. In the database you need a sequence.         -->
  <!--  ============================================================  -->
  <key-generator  name="SEQUENCE"  alias="jdoKeyGeneratorName">
    <param  name="sequence"   value="oracleSequenceName" />
    <param  name="returning"  value="true"    />
  </key-generator>
 
  <class  name="org.organisaton.project.MyClass"
          identity="id"  key-generator="jdoKeyGeneratorName">
    <description>ExportRestriction</description>
    <map-to  table="oracleTableName" />
    <field  name="id"            type="integer">
      <sql  name="person_id"     type="numeric" />
    </field>
    <field  name="firstName"     type="string">
      <sql  name="first_name"    type="varchar" />
    </field>
    <field  name="birthDate    type="date">
      <sql  name="birth_date"    type="date" />
    </field>
  </class>
</mapping>
--------------------------------------------------------------------------------
 
How to fill a referenced instance, from the same table:
 
table t_person colomns {person_id, first_name, brith_date, change_reason,
change_date_last, change_date_by}.
--------------------------------------------------------------------------------
<!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
                           "http://castor.exolab.org/mapping.dtd">
 

<mapping>
  <!--  ============================================================  -->
  <!--  Key generator(s) are needed if Oracle generates primary key   -->
  <!--  id for new rows. In the database you need a sequence.         -->
  <!--  ============================================================  -->
  <key-generator  name="SEQUENCE"  alias="jdoKeyGeneratorName">
    <param  name="sequence"   value="oracleSequenceName" />
    <param  name="returning"  value="true"    />
  </key-generator>
 
 
  <class  name="org.organisaton.project.MyClass"
          identity="id"  key-generator="jdoKeyGeneratorName">
    <description>ExportRestriction</description>
    <map-to  table="oracleTableName" />
    <field  name="id"            type="integer">
      <sql  name="person_id"     type="numeric" />
    </field>
    <field  name="firstName"     type="string">
      <sql  name="first_name"    type="varchar" />
    </field>
    <field  name="birthDate    type="date">
      <sql  name="birth_date"    type="date" />
    </field>
 
    <field  name="change.reason"     type="string">
      <sql  name="change_reason"     type="varchar" />
    </field>
    <field  name="change.date"       type="date">
      <sql  name="change_date_last"  type="date" />
    </field>
    <field  name="change.by"         type="integer">
      <sql  name="change_last_by"    type="numeric" />
    </field>
  </class>
 
</mapping>
--------------------------------------------------------------------------------
-----Original Message-----
From: Shalaka Chaudhari [mailto:[EMAIL PROTECTED]]
Sent: donderdag 11 april 2002 20:29
To: [EMAIL PROTECTED]
Subject: [castor-dev] Urgent: JDO Database name.

Hello,
              I am using Castor XML and Castor JDO for my project. I am a student and have a student account on the Oracle database server at our Univ. I have created my tables in the tablespace available to us. We do not have permissions to create our own database.
When trying to use Castor JDO, i need to do the following............
JDO jdo;
jdo.setDatabaseName( "databasename" );
--
---
So now in the given situation I do not know what to do? Can anyone suggest an alternative for that, if there is one? I really need the solution as soon as possible.
Any help will be highly appreciated.
 
Thanks in advance,
Regards,
Shalaka.


Join the world�s largest e-mail service with MSN Hotmail. Click Here
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

Reply via email to