ContactUs

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

Assigned Generator Class

Lets the application to assign an identifier to the object before the save() is called.
this is the default strategy if no <generator> element is specified.

        <generator class = "org.hibernate.id.Assigned" />
                    [or]
        <generator class = "assigned"/>

note : before we save the object in the DB, it is must to set the identifier value to the object otherwise it gives IdentifierGenerationException -- ids for this class must be manually assigned before calling save(). If we do not set studentNo then it gives this exception.

In the HBM file we can give assigned(logical name) or the complete class name.

note : if the DB column if PK and if we are inserting a duplicate record then it gives
ConstraintViolationException : could not execute JDBC batch update...
Related Posts Plugin for WordPress, Blogger...
Flag Counter