to your Product variable.
John.
luis barreiro wrote:
When I try to execute a query among my database with ojb I catch the next
exception:
java.lang.ClassCastException: Product
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQ
uery(Unknown Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQ
uery(Unknown Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQ
uery(Unknown Source)
at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollect
ionByQuery(Unknown Source)
at ProductOJBDAO.findAll(ProductOJBDAO.java:13)
at ProductAccessor.findAll(ProductAccessor.java:26)
at ProductAccessor.main(ProductAccessor.java:77)
InternalErrorException: Product
at ProductAccessor.findAll(ProductAccessor.java:28)
at ProductAccessor.main(ProductAccessor.java:77)
Source of Product class is....
public class Product
{
/**
* this is the primary key attribute needed by OJB to
* identify instances
*/
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
/** product name*/
protected String name;
/** price per item*/
protected int price;
/** stock of currently available items*/
protected int stock;
public Product() {}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public int getPrice() {
return this.price;
}
public void setPrice(int price) {
this.price = price;
}
public int getStock() {
return this.stock;
}
public void setStock(int stock) {
this.stock = stock;
}
}
and respositoy.xml asociated is....
<class-descriptor
class="Product"
table="product"
sequence-manager="
org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl"
>
<field-descriptor id="1"
name="id"
column="id"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
/>
<field-descriptor id="2"
name="name"
column="name"
jdbc-type="VARCHAR"
/>
<field-descriptor id="3"
name="price"
column="price"
jdbc-type="INTEGER"
/>
<field-descriptor id="4"
name="stock"
column="stock"
jdbc-type="INTEGER"
/>
</class-descriptor>
.... but when I try to insert or delete a instance of product on my
database, it's OK!!!!
Any idea ?¿?
Thanks in advanced and sorry for my poor english!!!!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]