-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Oracle VARCHAR insert, string truncated
PostPosted: Sun Aug 21, 2005 9:58 pm 
Newbie

Joined: Sun Aug 21, 2005 9:49 pm
Posts: 1
Hibernate version:
2.1.8

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!-- $Id: OrderVO.hbm.xml,v 1.10 2005/05/02 17:00:24 st_lim Exp $ -->

<hibernate-mapping package="sc.eCatalogue.OrderMgt.integration">
<!-- OrderVO -->
<class name="OrderVO"
table="ECAT.ECAT_ORDER">
<!-- id -->
<id name="id"
type="long"
unsaved-value="0">
<column name="ORDER_ID"
not-null="true"
sql-type="NUMBER(9)"/>
<generator class="sc.eCatalogue.common.hibernate.DateSequenceGenerator">
<param name="sequence">ECAT.SEQ_ECAT_ORDER_ORDER_ID</param>
<param name="date_format">yyyyMM</param>
<param name="no_of_digits">3</param>
</generator>
</id>
<!-- orderDate -->
<property name="orderDate"
column="DTE_ORDER"
not-null="true"
type="timestamp" />
<!-- expectDate -->
<property name="expectedDate"
column="DTE_EXPECT"
not-null="true"
type="timestamp" />
<!-- acctMgr -->
<component name="acctMgr"
class="sc.eCatalogue.UserMgt.integration.AcctMgrVO">
<!-- acctMgrNric -->
<property name="nric"
type="string">
<column name="ACCT_MGR_NRIC"
length="9"
not-null="true" />
</property>
<!-- acctMgrName -->
<property name="name"
type="string">
<column name="ACCT_MGR_NAME"
length="66"
not-null="true" />
</property>
</component>
<!-- customer -->
<component name="customer"
class="sc.eCatalogue.UserMgt.integration.UserVO">
<!-- user.dept-->
<property name="dept"
type="string">
<column name="CUST_DEPT"
length="80"
not-null="true" />
</property>
<!-- user.email -->
<property name="email"
type="string">
<column name="CUST_EMAIL_ADDR"
length="80"
not-null="true" />
</property>
<!-- user.name -->
<property name="name"
type="string">
<column name="CUST_NAME"
length="66"
not-null="true" />
</property>
<!-- custPhone -->
<property name="phone"
type="string">
<column name="CUST_PHONE"
length="15"
not-null="true" />
</property>
</component>
<!-- status -->
<many-to-one name="status"
class="OrderStatusVO"
foreign-key="FK_ECAT_ORDER_ORDER_ST"
cascade="none">
<column name="ORDER_STATUS_ID"
not-null="true"
sql-type="NUMBER(2)"/>
</many-to-one>
<!-- purpose -->
<property name="purpose"
type="string">
<column name="PURPOSE"
length="1000"
not-null="true" />
</property>
<!-- eventOrg -->
<property name="evtOrg"
type="string">
<column name="EVT_ORG"
length="600"
not-null="false" />
</property>
<!-- remarks -->
<property name="remarks"
type="string">
<column name="REM"
length="1000" />
</property>
<!-- items -->
<set name="orderedItems"
inverse="true"
lazy="false"
cascade="all-delete-orphan">
<key column="ORDER_ID"/>
<one-to-many class="OrderedItemVO"/>
</set>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
public OrderVO createOrder(OrderVO order)
throws RemoteException, OrderBizException, TxBizException, DAOException,
ItemBizException {
OrderVO result = null;

if (order == null) {
throw new OrderBizException(OrderBizException.EXCEPTION_REQUIRED_ORDER);
}

_log.info("createOrder(" + order.getOrderDate() + ")");

if (order.getAcctMgr() == null) {
throw new OrderBizException(OrderBizException.EXCEPTION_REQUIRED_ACCTMGR);
}

// Perform operation on order
OrderDAO dao = null;

try {
dao = new OrderDAO();

ItemMgrEJB itemEJB = new ItemMgrEJB();
ItemDAO itemDAO = new ItemDAO(dao);
List qtyItems = new ArrayList();

// check if there is enough items to be ordered
if ((order.getOrderedItems() == null) ||
order.getOrderedItems().isEmpty()) {
throw new OrderBizException(OrderBizException.EXCEPTION_REQUIRED_ORDEREDITEM);
} else {
for (Iterator i = order.getOrderedItems().iterator(); i.hasNext();) {
Object o = i.next();

if ((o == null) || !(o instanceof OrderedItemVO)) {
throw new OrderBizException(OrderBizException.EXCEPTION_REQUIRED_ORDEREDITEM);
} else {
OrderedItemVO item = (OrderedItemVO) o;

if (item.getQty() > 0) {
SubItemVO subitem = itemEJB.checkEnoughQty(itemDAO,
item.getSubitem().getId(), (-1 * item.getQty()));

if (subitem != null) {
qtyItems.add(subitem);
} else {
subitem = itemDAO.selectSubitemBySubitemId(item.getSubitem()
.getId());

if (subitem.getItem() != null) {
item.setSubitem(subitem);
}
}
}
}
}
}

// Return the errors
_log.debug("qtyItems size = (" + qtyItems.size() + ")");

if ((qtyItems != null) && !qtyItems.isEmpty()) {
ItemBizException e = new ItemBizException(ItemBizException.EXCEPTION_NOTENOUGH_SUBITEM);
e.setItems(qtyItems);
throw e;
}

result = dao.insertOrder(order);
_log.info("Order #(" + result.getId() + ") was inserted.");

// Add Tx
TxMgrEJB txMgr = new TxMgrEJB();
TxLogVO tx = txMgr.createTxLogForOrder(dao, order, "New Request",
order.getAcctMgr());
_log.info("Tx #(" + tx.toString() + ") was created for order.");

dao.flush();
dao.end();
} catch (DAOException e) {
_log.error(e);
this._sessionContext.setRollbackOnly();
throw e;
} catch (RemoteException e) {
_log.error(e);
this._sessionContext.setRollbackOnly();
throw e;
} catch (ItemBizException e) {
_log.error(e);
this._sessionContext.setRollbackOnly();
throw e;
} catch (TxBizException e) {
_log.error(e);
this._sessionContext.setRollbackOnly();
throw e;
} finally {
if (dao != null) {
dao.end();
}
}

return result;
}

Full stack trace of any exception that occurs:
None

Name and version of the database you are using:
Oracle 9.1.2

The user has keyed in a remark of at least 500 odd characters, but only 300 odd characters are found to be stored in the oracle database.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 10:11 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
What happens if you try to insert large #s of characters via JDBC ? Do you get the problem w/ an update as well? Double check to see if the field is really a varchar.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.