You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by DG...@EvergreenInvestments.com on 2006/02/01 17:27:45 UTC

[OT] Re: struts + oracle+ hibernate

1. Ask Questions The Smart Way: 
www.catb.org/~esr/faqs/smart-questions.html
2. Recompile with debug on and step through AddItemAction
3. Try the Hibernate forum:  http://forum.hibernate.org/

-Dennis





"Raghuveer" <ra...@infotechsw.com> 
02/01/2006 11:01 AM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>


To
<us...@struts.apache.org>
cc

Subject
struts + oracle+ hibernate






hi,

Could  you help me for Data insertion into Oracle daabase.

I have Table item in scott/tiger database.
With below coe i could retrive data.
But when i save NEW data ,I could not save to my oracle database table.


Experts help !!


-------------------------------

Oracle Database table
---------------------

DROP TABLE ITEM CASCADE CONSTRAINTS ;

CREATE TABLE ITEM (
  ID           NUMBER (11)   NOT NULL,
  NAME         VARCHAR2 (32)  NOT NULL,
  DESCRIPTION  VARCHAR2 (32)  NOT NULL,
  CONSTRAINT PKID
  PRIMARY KEY ( ID )
    USING INDEX
     TABLESPACE USERS PCTFREE 10
     STORAGE ( INITIAL 128K NEXT 128K PCTINCREASE 0 ))
   TABLESPACE USERS NOLOGGING
   PCTFREE 10
   PCTUSED 40
   INITRANS 1
   MAXTRANS 255
  STORAGE (
   INITIAL 131072
   NEXT 131072
   MINEXTENTS 1
   MAXEXTENTS 4096
   FREELISTS 1 FREELIST GROUPS 1 )
   NOCACHE;


------------
Item.hbm.xml
----------------
<hibernate-mapping>
    <class name="com.edhand.example1.Item" table="item" >
        <id name="id" column="id" type="java.lang.Long" unsaved-value="0">
            <generator class="native"/>
        </id>
        <property name="name" column="name" type="java.lang.String" />
        <property name="description" column="description"
type="java.lang.String" />
    </class>
</hibernate-mapping>


--------------------------------
ERROR

java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not save
object           at com.edhand.example1.ItemService.addItem(Unknown 
Source)          at
com.edhand.example1.AddItemAction.execute(Unknown Source) at










---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org