Hi,
Not Able to insert records using Hibernate version: 2.0
and database SQL Server 2005 when ROWID is present in the table column.
Code:
CREATE TABLE [dbo].[C_CMTC] (
[I_CMTC] numeric(20, 0) NOT NULL,
[TTL_PRCS] numeric(20, 0) NULL,
[TTL_THRD] numeric(20, 0) NULL,
[ROWID] uniqueidentifier NOT NULL DEFAULT (newid()))
ON [PRIMARY];
GO
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.farbeyond.server.dao.entities.C_CMTCImpl"
table="C_CMTC">
<id name="ixcmtc" type="long">
<column name="I_CMTC" precision="20" scale="0" />
<generator class="increment" />
</id>
<property name="ttlxprcs" type="long">
<column name="TTL_PRCS" precision="20" scale="0" />
</property>
<property name="ttlxthrd" type="long">
<column name="TTL_THRD" precision="20" scale="0" />
</property>
<property name="rowid" type="string" >
<column name="ROWID" length="36" unique="true" />
<generator class="native" />
</property>
</class>
</hibernate-mapping>
While insert the data from Hibernate we get the following Error.
EVERE: Error parsing XML: XML InputStream(23) The content of element type "property" must match "(meta*,(column|formula)*,type?)".
Exception in thread "main" org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/seeinfobiz/click/entitybean/Cxmxtxc.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
at hibernateexample.Main.main(Main.java:26)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
But if I insert record using the following query :
Code:
insert into dbo.C_CMTC (I_CMTC,TTL_PRCS,TTL_THRD)
values (3,4,3);
it inserts the records the desired records.
Any help would be greatly appreciated.
Best Regards,
Ashwini Kumar