Hibernate version 2.1.6
Weblogic version 8.1.3
Oracle 8.1.7
Using oracle jdbc thin driver.
When create attachment, the parentID are floating number such as 2.53E-124, 1.46E56
Attachment attachment = new Attachment();
attachment.setName(name);
attachment.setType(Attachment.TYPE_DOC);
attachment.setLinkAlt(name);
attachment.setParent(article);
article.getAttachments().add(attachment);
session.save(attachment);
When runing on WebSphere, Tomcat, it's OK.
The mapping file is below.
<class name="com.gpower.services.content.entity.Article" table="CMS_ARTICLE" polymorphism="explicit">
<cache usage="read-write"/>
<id name="ID" type="long">
<generator class="increment"/>
</id>
<property name="parentID"/>
<property name="name"/>
<property name="status"/>
<property name="pubFlag"/>
...
<bag name="locations" table="CMS_CHANNEL_ARTICLE" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="articleID"/>
<one-to-many class="com.gpower.services.content.entity.Location"/>
</bag>
<bag name="relations" table="CMS_ARTICLE_RELATION" lazy="false">
<cache usage="read-write"/>
<key column="articleID"/>
<many-to-many class="com.gpower.services.content.entity.Content" column="relationID"/>
</bag>
<bag name="attachments" table="CMS_ATTACHMENT" inverse="true" lazy="true" cascade="all">
<cache usage="read-write"/>
<key column="parentID"/>
<one-to-many class="com.gpower.services.content.entity.Attachment"/>
</bag>
</class>
<class name="com.gpower.services.content.entity.Attachment" table="CMS_ATTACHMENT">
<cache usage="read-write"/>
<id name="ID" type="long">
<generator class="increment"/>
</id>
<property name="name"/>
<property name="filename"/>
<property name="type"/>
<property name="linkAlt"/>
<property name="srcFile"/>
<property name="fileExt"/>
<property name="creationDate"/>
<property name="modifiedDate"/>
<property name="owner"/>
<many-to-one name="parent" column="parentID" class="com.gpower.services.content.entity.Article"/>
</class>
|