posted 18 years ago
Hi guys
i have a dilemma and doubt about this
i have a superclass call for instance HeaderWarehouse (sorry for my grammar)
and 2 subclasses (Inheritance) RetireWarehouse InsertWarehouse
this is for the control of products in a "Warehouse"
of course each RetireWarehouse-InsertWarehouse has their relations
to RetireDetailsWarehouse InsertDetailsWarehouse
well the superclass can has this fields or variables
and each subclass has a unique Set type variable for
RetireDetailsWarehouse InsertDetailsWarehouse
the problem is this , the id must be autoincrement
so i use xdoclet for hibernate and done
when i create a new instance of the subclasses and they are inserted by hibernate
it create the autoincrement id but for the 2 types
so if i create
for instance 4 new objects for
RetireWarehouse
the id generated should be 1,2,3,4
and thats right
but if i try to create an object for InsertWarehouse i recieve the next number
5
so the question and i need your experience,
how i can have the id autoincrement for each subclass???
that means
4 new objects for
RetireWarehouse
the id generated should be 1,2,3,4
and instead for InsertWarehouse it should recieve the 1
the obvious and wrong solution could be kill the Inheritance and repeat the same variables for each
ex-subclasses, but i dont want lose the Inheritance
i hope you can see my point
thanks for advanced
kill your pride, share your knowledge with all