Can the id be manually set in hibernate if the id is specified as “Identity” in the hbm file?
i.e. can i call the .setId() method while i have set the id as “Identity” in hibernate hbm file?
Can the id be manually set in hibernate if the id is specified as
Share
You can of course call method, but it will cause problems later on. Such a attribute is persisted the identity column in database. Often value in such a column cannot also be updated via SQL.
If you want to set values by yourself, do not use identity columns in database. Also use assigned (default) as a generator.