We are getting illegal SQL generated by the Castor OQL/JDO and we wondered
if anyone knows a solution, or whether this is a bug in the Castor OQL/JDO.
Situation:
We have a base class Base which is extended by two other classes, say
SubClassA and SubClassB.
These two subclasses have no new fields themselves, just different methods
on how to handle certain situations, they are the result of the refactoring
Replace Conditional with Polymorphism. We wanted our table design to
reasonably mirror the object structure so we have Database tables like:
BASE, columns are: ID, DATA1, DATA2, ...
SUBCLASSA, columns are: ID
SUBCLASSB, columns are: ID
As you can see, the subclass tables just have an ID column referring to the
ID in the base table. This effectively is a flag, if the id occurs in the
SubClassA table the class must be of type SubClassA.
This works fine for persisting and loading using JDO. However, when we load
an object using OQL and make some changes to it and commit the change we
get an SQL error. Consulting the SQL log we see an attempted statement of
the form
"UPDATE SUBCLASSA SET WHERE ID=9"
i.e. there is an empty set clause. This seems like an error. There is no
need for any update of this table.
Should this be handled properly by JDO? On a more general note, does this
point to a flaw in our table design? We realise we could just put a column
in the BASE table indicating the subtype, but we thought this design more
flexible and extendible.
Nick
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev