If my assumption is correct, Hibernate is more on transactions and Data Manipulation and not in the Date Definition. I would like to know
How can i add constraints to table with Hibernate?
The two ways that strikes my mind is
a. In the setter method of the pojo class, add the constraint. But i need to know if this will work well in all the case.
b. using native sql, alter the table and add the constraint.
Please let me know which is correct way to add the constraint in the table.
There are a variety of annotations that impact how SQL is generated. Just some of the annotations for a Column are as follows:
Now those are just JPA specific. Hibernate has extensions that go beyond the JPA specification as well. You'd have to research a bit deeper to find out how granular the types of constraints on columns and tables can be.
posted 11 years ago
Did you mean that I can add/represent constraint like check in the mappings of the entity.
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!