@ernst
no problem ... i've got in some cases similar problems ... so why not share thoughts ...
I've got some denormalized tables, too ... and some references sharing parts of the same fk :) ...
One thing i don't understand so far ... you have a property which will be set to 'null' in case of 0,1,2 and 3 in db for reading (this property is the fk for a many-to-one-relationship).
The Application needs to know what value is corrently in the db ... i could imagine something like this:
Code:
if (manyToOneRef instanceof DummyObject1) then ...
Your application only needs to know which value is in db and won't work with the DummyObject itself. Am i right with that? ... so why not use the property?
Return 'null' for the many-to-one and set the value 0...3 for the property.
Perhaps no setter-Method for this property, because the value will be set from the UserType at reading or from your domain-object during the set-call of the 'many-to-one' ...
If your Application works with those values, they have business-meaning .. if you sometimes change the keys, those values would be still needed ... so you can use this property ...
Or do i think in a wrong way?
gtx
curio