Basilio wrote:
Use in your mapping:
Code:
<id name="objectId" column="OBJECT_ID" type="java.lang.Integer">
<generator class="assigned"/>
</id>
instead
Basil
Be sure to read the documentation on using the "assigned" generator. There are several issues regarding use of this type of ID. For example, Hibernate won't be able to tell by the ID alone whether to save or update the object.
And I don't think having to use an HQL Query over load() for the License # Search is, by itself, enough of a reason not to user surrogate keys in your database. There are many papers on this subject and I would suggest reading some of them.
For example:
http://www.agiledata.org/essays/dataModeling101.html
And this statement "then i have to use the setters to set the values of all other fields and there are very many fields" is incorrect. Hibernate will populate your object(s) the same whether you're using a load() or HQL query.