Update hibernate files to initialize timestamp
Updated the hibernate hbm.xml files to correct the following issues:
1) Timestamps had generated="insert" but hibernate was not auto-populating
the timestamp value thus the DB was generating an exception. Modified
the definition of this field to cause hibernate to provide the default
value of CURRENT_TIMESTAMP. This impacted most of the hbm.xml files.
2) While running junit tests, the following message appeared in the log
underneath most of the hbm.xml files:
Recognized obsolete hibernate namespace
http://hibernate.sourceforge.net/. Use namespace
http://www.hibernate.org/dtd/ instead. Refer to
Hibernate 3.6 Migration Guide!
Updated most of the hbm.xml files, changing the namespace per the
guide. Note: a couple of the files were already correctly configured.
Change-Id: Id96775b7bd7a42da0c00e208e33aed6fa96ab996
Issue-Id: SO-215
Signed-off-by: Jim Hahn <jrh3@att.com>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
index ee12b45..8ee3ddd 100644
--- a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
@@ -20,7 +20,7 @@
-->
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="org.openecomp.mso.requestsdb.InfraActiveRequests" table="INFRA_ACTIVE_REQUESTS">
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
index 60fc359..f00c2da 100644
--- a/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
@@ -36,7 +36,9 @@
<property name="operationContent" column="OPERATION_CONTENT" type="string" length="256"/>
<property name="progress" column="PROGRESS" type="string" length="256"/>
<property name="reason" column="REASON" type="string" length="256"/>
- <property name="operateAt" column="OPERATE_AT" type="timestamp" generated="insert" insert="false" update="false"/>
+ <property name="operateAt" type="timestamp" generated="insert" insert="false" update="false" not-null="true">
+ <column name="OPERATE_AT" default="CURRENT_TIMESTAMP"/>
+ </property>
<property name="finishedAt" column="FINISHED_AT" type="timestamp" generated="update" insert="false" update="false"/>
</class>
</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml
index 95ccfda..f755ad0 100644
--- a/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml
@@ -30,6 +30,8 @@
<id name="siteName" type="string" column="SITE_NAME"/>
<property name="status" column="STATUS" type="boolean" length="256"/>
- <property name="created" column="CREATION_TIMESTAMP" type="timestamp" generated="insert" insert="false" update="false"/>
+ <property name="created" type="timestamp" generated="insert" insert="false" update="false" not-null="true">
+ <column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
+ </property>
</class>
</hibernate-mapping>