hello. two beans: person and company - a person may have 0 or 1 companies. in the database, person has a company_id field.
originally, the person.company_id field was null-able and everything was fine. recently, the client requested that we not store nulls in that field because it is causing problems in their other systems. they want an integer value of 0 to be stored instead. obviously this doesn't work - because there is no company with an id of 0.
my question is - is there a way to handle this in hibernate? (i'd love to leave the null constraint in, as removing it and using a magic number is...not desirable. but i'm looking for options.)
i appreciate your time.
chris
** exception thrown **
UnresolvableObjectException: No row with the given identifier exisits: 0, of class: CompanyBean
** many-to-one declaration inside person **
<many-to-one name="company" class="com.ci.db.member.CompanyBean" column="company_id"/>
** details
hibernate version: 1.2.5
db: mysql
|