org.exolab.castor.jdo.PersistenceException: Nested error:
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver][SQLServer]'Produits' :
bad object name
The erroe occurs when i try to create an
object "Product" from the table "Products" of the "PRODUCTS"
database...
*********************************************************************
Here's my source code :
public class DatabaseTests {
public
DatabaseTests(){
JDO jdo;
Database
db;
// Define the JDO
object
jdo = new
JDO();
jdo.setDatabaseName( "PRODUCTS" );// PRODUCTS is the DB's
name
jdo.setConfiguration( "e:\\files\\jdo\\dbconfig.SQLServer"
);
jdo.setClassLoader( getClass().getClassLoader() );
// Obtain a new
database
try{
db =
jdo.getDatabase();
// Begin a
transaction
db.begin();
// Here
comes the error :
Produit pdt = (Product) db.load(Product.class, new
Integer(1));
// Do
something
//. . .
// Commit the
transaction, close
database
db.commit();
db.close();
}
catch
(Exception e){System.out.println(e);
}
}
public static void
main(String args[]) {
DatabaseTests
DT;
DT = new DatabaseTests();
}
}
The Produit class :
package JDOtest;
public class Product
{
protected Integer id;
protected String
description;
public Product(){}
public Integer
getId(){return id;}
public String getDescription(){return
description;}
public void setId(Integer
id){this.id=id;}
public void setDescription(String
description){this.description=description;}
}
My XML configuration files :
Dbconfig.xml:
<?xml version="1.0"?>
<database
name="PRODUCTS" engine="sql-server">
<driver
class-name="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@nantes-futuna:1521:sca">
<param name="User" value="system" />
<param name="Password" value="manager" />
</driver>
<mapping
href="e:\\files\\jdo\\Products.xml" />
</database>
The mapping file Products.xml :
<?xml
version="1.0"?>
<mapping>
<class
name="JDOtest.Product" identity="id">
<description>basis
product</description>
<map-to
table="Products" />
<field name="id"
type="integer">
<sql
name="id" type="integer" />
</field>
<field
name="description" type="string">
<sql name="descr_product" type="varchar"
/>
</field>
</class>
</mapping>
The Products table is defines as follow
:
"PK id
integer, descr_product varchar, FK familly
integer"
Any idea
???