[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4341) There is no annotation to specify default value for a column
Rodrigo Queiroz (JIRA)
noreply at atlassian.com
Fri Jan 29 15:07:30 EST 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35406#action_35406 ]
Rodrigo Queiroz commented on HHH-4341:
--------------------------------------
In Oracle database, even setting the column with a default value woudn't work. In this example:
CREATE TABLE TEST (
ID NUMBER(20) NOT NULL,
T NUMBER 20 DEFAULT 0
)
if we try:
INSERT INTO TEST (ID) VALUES (1);
we'll get:
ID, T
1, 0
But with hibernate, the generated insert is:
INSERT INTO TEST (ID, T) VALUES (1, NULL);
Which will force Oracle to accept the NULL value to T, giving us:
ID, T
1, NULL
In my case, the T column should be NOT NULL. Even though I have a default value to the column, I still get a constraint violation.
> There is no annotation to specify default value for a column
> ------------------------------------------------------------
>
> Key: HHH-4341
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4341
> Project: Hibernate Core
> Issue Type: New Feature
> Components: annotations
> Reporter: Nicolae Bucalaete
> Priority: Minor
>
> In hibernate annotation you can't specify default value for a column.
> If you use xml files for mapping then you have this feature.
> I consider that this is a major problem with annotation.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list