ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kezerashvili, Denis" <Denis.Kezerashv...@gs.com>
Subject Problem exposing protected setters for iBatis
Date Thu, 08 May 2008 16:16:40 GMT
Here is the problem that I have:

I have an Entity class that has a private field ID (the actual name is
id), which contains the db id for the entity persisted. 
I have a public getId() and protected setId() methods.
iBATIS sets id when the record is inserted into the db, nobody else
should be setting the id, therefore the setter is not public.
I have several classes that extend Entity (User, Address, etc.). 
As long as the classes extending Entity live in the same package all is
good and the ID is being set as expected. But when the child class is in
another package iBATIS seems to be unable to set the id. 
Is there a way of solving this issue other than making setId() public?

Thank you in advance


View raw message