Re: How to set null for a column for which the corresponding java type is long

2004-01-28 Thread Andrei Ivanov

But isn't that much slower?

/me is a newbie in java and ojb

On Wed, 28 Jan 2004, Danilo Tommasina wrote:

 Hi,
 
 Do not use a primitive data type in your persistent class, use instead a 
   subtype of Number. (Integer, Long, BigInteger, BigDecimal,... )
 
 
 cheers
 Danilo
 
  Hi, All
  
  I have a data base column. The data type is number
  (10). It is nullable. The JDBC type defined in
  repository is BIGINT and the corresponding java type
  is long (default). Can anybody tell me how to save a
  record so that the value of that column is null
  instead of zero?
  
  Thanks,
  Zhe
  
  __
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free web site building tool. Try it!
  http://webhosting.yahoo.com/ps/sb/
  
  -
  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]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



`Single Proxy for a Whole Collection` problem

2004-01-08 Thread Andrei Ivanov

Hello,
I've created a mapping like this:

class-descriptor
class=com.ines.flanco.model.ProductTO
table=products

field-descriptor
name=id
column=id
jdbc-type=INTEGER
nullable=false
primarykey=true
autoincrement=true
sequence-name=products_id_seq
/
field-descriptor
name=name
column=name
jdbc-type=VARCHAR
nullable=false
/
collection-descriptor
name=symbols
element-class-ref=com.ines.flanco.model.SymbolTO
proxy=true
auto-update=true
auto-delete=true
indirection-table=products_symbols
fk-pointing-to-this-class column=product/
fk-pointing-to-element-class column=symbol/
/collection-descriptor
/class-descriptor

And created the objects:

public class ProductTO implements java.io.Serializable {

protected int id;
protected String name;
protected Vector symbols;

getters and setters...

public void setSymbols(Vector symbols){
this.symbols = new Vector(symbols);
}
public Vector getSymbols(){
return symbols;
}
}

public class SymbolTO implements java.io.Serializable {

protected int id;
protected String name;
protected String description;

getters and setters...
}

If I don't use the proxy feature for the collection everything is fine.

My problem is that I get an exception when I mark it as a proxy:

[PersistentField] ERROR: while set field:
object class[ com.ines.flanco.model.ProductTO
target field: symbols
target field type: class java.util.Vector
object value class: org.apache.ojb.broker.accesslayer.ListProxy
object value: [EMAIL PROTECTED]
null
java.lang.IllegalArgumentException
at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
at java.lang.reflect.Field.set(Field.java:519)
at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doSet(Unknown
 
Source)
at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.set(Unknown 
Source)
.

2004-01-08 16:46:59 StandardWrapperValve[action]: Servlet.service() for 
servlet action threw exception
org.apache.ojb.broker.metadata.MetadataException: Error setting 
field:symbols in object:com.ines.flanco.model.ProductTO
at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doSet(Unknown
 
Source)
at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.set(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollection(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollections(Unknown 
Source)



Can you please tell me what I did wrong ?

Thank you.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]