Joined: Mon Jun 18, 2007 1:44 am Posts: 2
|
Mapping documents:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.DAO.account.Account" table="account" catalog="pao">
<id name="accountid" type="java.lang.Integer">
<column name="ACCOUNTID" />
<generator class="native" />
</id>
<many-to-one name="accstatid" column="ACCSTATID" class="com.DAO.account.Accountstatus">
</many-to-one>
<property name="admoid" type="java.lang.Integer">
<column name="ADMOID" />
</property>
<property name="afdnum" type="java.lang.Integer">
<column name="AFDNUM" />
</property>
<property name="area" type="java.lang.Integer">
<column name="AREA" />
</property>
<property name="areaest" type="java.lang.Short">
<column name="AREAEST" />
</property>
<property name="blacklist" type="java.lang.Short">
<column name="BLACKLIST" />
</property>
<property name="blockindicator" type="java.lang.Short">
<column name="BLOCKINDICATOR" />
</property>
<property name="brakod" type="java.lang.String">
<column name="BRAKOD" length="8" />
</property>
<property name="buyingcomb" type="java.lang.Short">
<column name="BUYINGCOMB" />
</property>
<property name="carrier" type="java.lang.Integer">
<column name="CARRIER" />
</property>
<property name="cebnrid" type="java.lang.String">
<column name="CEBNRID" length="4" />
</property>
<property name="changedate" type="java.util.Date">
<column name="CHANGEDATE" length="10" />
</property>
<property name="classid" type="java.lang.String">
<column name="CLASSID" length="10" />
</property>
<property name="closingdays1" type="java.lang.String">
<column name="CLOSINGDAYS1" length="25" />
</property>
<property name="closingdays2" type="java.lang.String">
<column name="CLOSINGDAYS2" length="25" />
</property>
<property name="closingdays3" type="java.lang.String">
<column name="CLOSINGDAYS3" length="25" />
</property>
<property name="closingdays4" type="java.lang.String">
<column name="CLOSINGDAYS4" length="25" />
</property>
<property name="closingdays5" type="java.lang.String">
<column name="CLOSINGDAYS5" length="25" />
</property>
<property name="closingdays6" type="java.lang.String">
<column name="CLOSINGDAYS6" length="25" />
</property>
<property name="closingdays7" type="java.lang.String">
<column name="CLOSINGDAYS7" length="25" />
</property>
<property name="cocnumber" type="java.lang.String">
<column name="COCNUMBER" length="15" />
</property>
<many-to-one name="commid" column="COMMID" class="com.DAO.account.Communication">
</many-to-one>
<property name="createdate" type="java.util.Date">
<column name="CREATEDATE" length="10" />
</property>
<property name="creditcheck" type="java.lang.String">
<column name="CREDITCHECK" length="1" />
</property>
<property name="creditlimit" type="java.lang.Double">
<column name="CREDITLIMIT" precision="14" />
</property>
<property name="creditlimitdate" type="java.util.Date">
<column name="CREDITLIMITDATE" length="10" />
</property>
<many-to-one name="currid" column="CURRID" class="com.DAO.account.Currency">
</many-to-one>
<property name="dagnum" type="java.lang.Integer">
<column name="DAGNUM" />
</property>
<property name="delflag" type="java.lang.Short">
<column name="DELFLAG" />
</property>
<property name="deliveryblock" type="java.lang.Short">
<column name="DELIVERYBLOCK" />
</property>
<property name="deltermid" type="java.lang.String">
<column name="DELTERMID" length="3" />
</property>
<property name="departments" type="java.lang.String">
<column name="DEPARTMENTS" length="20" />
</property>
<property name="dispatchid" type="java.lang.String">
<column name="DISPATCHID" length="2" />
</property>
<property name="disptypeseqid" type="java.lang.String">
<column name="DISPTYPESEQID" length="1" />
</property>
<property name="exportindicator" type="java.lang.String">
<column name="EXPORTINDICATOR" length="1" />
</property>
<property name="externalcode" type="java.lang.String">
<column name="EXTERNALCODE" length="8" />
</property>
<property name="factoringcode" type="java.lang.Integer">
<column name="FACTORINGCODE" />
</property>
<property name="foundationdate" type="java.util.Date">
<column name="FOUNDATIONDATE" length="10" />
</property>
<many-to-one name="gencodeid" column="GENCODEID" class="com.DAO.account.Genericcode">
</many-to-one>
<property name="history" type="java.lang.String">
<column name="HISTORY" length="240" />
</property>
<property name="hqid" type="java.lang.Integer">
<column name="HQID" />
</property>
<property name="hqcocnr" type="java.lang.String">
<column name="HQCOCNR" length="15" />
</property>
<property name="klapri" type="java.lang.Short">
<column name="KLAPRI" />
</property>
<many-to-one name="langcode" column="LANGCODE" class="com.DAO.account.Language">
</many-to-one>
<property name="legalbody" type="java.lang.String">
<column name="LEGALBODY" length="40" />
</property>
<property name="locationid" type="java.lang.Short">
<column name="LOCATIONID" />
</property>
<property name="lsize" type="java.lang.String">
<column name="LSIZE" length="5" />
</property>
<property name="mutations" type="java.lang.String">
<column name="MUTATIONS" length="65535" />
</property>
<property name="mutdat" type="java.util.Date">
<column name="MUTDAT" length="10" />
</property>
<property name="name" type="java.lang.String">
<column name="NAME" length="40" />
</property>
<property name="nkccode" type="java.lang.Integer">
<column name="NKCCODE" />
</property>
<property name="numberempest" type="java.lang.Short">
<column name="NUMBEREMPEST" />
</property>
<property name="numberemployees" type="java.lang.Double">
<column name="NUMBEREMPLOYEES" precision="8" />
</property>
<property name="opendelivery" type="java.lang.Double">
<column name="OPENDELIVERY" precision="13" />
</property>
<property name="openorder" type="java.lang.Double">
<column name="OPENORDER" precision="13" />
</property>
<property name="partdel" type="java.lang.Short">
<column name="PARTDEL" />
</property>
<property name="paytermid" type="java.lang.String">
<column name="PAYTERMID" length="4" />
</property>
<property name="railway" type="java.lang.String">
<column name="RAILWAY" length="25" />
</property>
<property name="recnr" type="java.lang.Integer">
<column name="RECNR" />
</property>
<property name="recommendprice" type="java.lang.Short">
<column name="RECOMMENDPRICE" />
</property>
<property name="reference" type="java.lang.String">
<column name="REFERENCE" length="10" />
</property>
<property name="referencecode" type="java.lang.String">
<column name="REFERENCECODE" length="10" />
</property>
<property name="regnumber" type="java.lang.String">
<column name="REGNUMBER" length="20" />
</property>
<property name="remarks" type="java.lang.String">
<column name="REMARKS" length="65535" />
</property>
<property name="revnum" type="java.lang.Integer">
<column name="REVNUM" />
</property>
<property name="salespersonId" type="java.lang.String">
<column name="SALESPERSON_ID" length="3" />
</property>
<property name="salesrepId" type="java.lang.String">
<column name="SALESREP_ID" length="8" />
</property>
<property name="searchcode" type="java.lang.String">
<column name="SEARCHCODE" length="10" />
</property>
<property name="specstatus" type="java.lang.String">
<column name="SPECSTATUS" length="1" />
</property>
<property name="stdfmtsubject" type="java.lang.String">
<column name="STDFMTSUBJECT" length="40" />
</property>
<property name="stdfmttext" type="java.lang.String">
<column name="STDFMTTEXT" length="240" />
</property>
<property name="stockhandlingcode" type="java.lang.Integer">
<column name="STOCKHANDLINGCODE" />
</property>
<property name="sublocationid" type="java.lang.Short">
<column name="SUBLOCATIONID" />
</property>
<property name="ssize" type="java.lang.String">
<column name="SSIZE" length="5" />
</property>
<property name="targetgroup" type="java.lang.String">
<column name="TARGETGROUP" length="240" />
</property>
<property name="turnoverid" type="java.lang.String">
<column name="TURNOVERID" length="3" />
</property>
<property name="turnoverest" type="java.lang.Short">
<column name="TURNOVEREST" />
</property>
<property name="vatid" type="java.lang.String">
<column name="VATID" length="3" />
</property>
<property name="vatregnr" type="java.lang.String">
<column name="VATREGNR" length="20" />
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
public static void update(Object pobject,HttpServletRequest request) {
Session session;
ServletContext context=request.getSession().getServletContext();
SessionFactory _factory = (SessionFactory) context.getAttribute("SESSION_FACTORY_KEY_CRM");
session=_factory.openSession();
try {
Transaction tx = session.beginTransaction();
System.out.println("*****************update method of hibernate *********************");
session.update(pobject);
session.flush();
tx.commit();
System.out.println("*****************update completed *********************");
} catch (HibernateException e)
{
System.out.println("Argh ! Error occurred while creating object " + pobject + ": " );
e.printStackTrace();
} finally
{
if (session != null && session.isOpen())
{
try {
session.close();
} catch (HibernateException e)
{
System.out.println("Ouch ! Error occurred while closing session: ");
e.printStackTrace();
}
}
}
}
Name and version of the database you are using: mysql 5
While updating the account table i am just specifying the accountid and and setting the delflag value alone.
After updating its setting null to all other elements. And just setting the delflag value alone. how to stop this without setting null.
please help me.
|
|