Hi,
I will explain my issues using an example.
issue 1)
I'm using cayenne 3.0 in combination with an Oracle 10.2 database.
I have 2 tables A and B. There is no relationship between the tables.
I want to store the primary key value of A in B but I don't want to create it a a field in A.
Because I don't have a relationship I need to create this field in the B and explicitly populate it.
Both tables have a unique primary key. Both keys are generated using a custom sequence.
As the queue is used to process a lot of records the type is set to NUMERIC.
Cayenne maps this to a java BigDecimal.
This is what I do
create datacontext
create queue record
register with datacontext
commit
create log record
register with datacontext
store the primary key of the queue record in the log record. This is done like this
log.setQueueId((BigDecimal)DataObjectUtils.pkForObject(queue))
commit
Now I get an exception.
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer
After investigation it seems that the key value which is generated does not have type BigDecimal.
If I however read a record from B then it does have type BigDecimal.
issue 2)
Further testing showed that the value of the key is actually wrapping at Integer.MAX_VALUE.
If it goes over this value it first becomes negative and then is going back to zero after which
it is starting over from zero.
In Oracle however the value of the sequence is increasing correctly. So it looks like there is some
type mapping issue here.
Sorry for the weird example but I'm trying to make my point.
tx
Hans
This archive was generated by hypermail 2.0.0 : Mon Aug 23 2010 - 15:09:09 UTC