db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bhiyavudh" <bhiyav...@hotmail.com>
Subject Re: Auto ID Generation with Oracle fails
Date Mon, 19 Jan 2004 17:47:08 GMT
Hi,
 Once I ask the same question on this list and got the answer,  here is what
work for me both for oracle 8i and 9i.

1) The sample from my schema file, don't forget the element
<id-method-parameter value="yoursequencename"/> at the end.
<database name="ingeo" defaultIdMethod="native">

<table name="category" description="category">

<column

name="ID_category"

required="true"

primaryKey="true"

type="INTEGER"

description="ID_category"/>

<column

name="ID_main"

required="true"

type="INTEGER"

description="ID_main"/>

<column

name="tpCat"

required="true"

type="INTEGER"

description="tpCat"/>

<column

name="keyword"

required="true"

type="VARCHAR"

size="255"

description="keyword"/>

<column

name="thesaName"

required="true"

type="VARCHAR"

size="255"

description="thesaName"/>

<column

name="thesaDate"

required="true"

type="DATE"

description="thesaDate"/>

<foreign-key foreignTable="main">

<reference

local="ID_main"

foreign="ID_main"/>

</foreign-key>

<id-method-parameter value="CATEGORY_SEQ"/>

</table>

</database>

 2) Don't forget to rebuild  your torque objects after changing to
defaultIdMethod="native"

----- Original Message ----- 
From: "Steffen Mueller" <torque@mueller.ca>
To: <torque-user@db.apache.org>
Sent: Monday, January 19, 2004 12:46 PM
Subject: Auto ID Generation with Oracle fails


> I set the idMethod to "native" and am using Oracle 8i. "autoIncrement" is
> "true" for the PK. The sequences have been created. However, when I try to
> insert a record into a table, the following error occurs:
>
> org.apache.torque.TorqueException: IdGenerator for table 'Department' is
> null at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:708) at
>
de.spiritlink.lqa.om.BaseDepartmentPeer.doInsert(BaseDepartmentPeer.java:212
)
> at
>
de.spiritlink.lqa.om.BaseDepartmentPeer.doInsert(BaseDepartmentPeer.java:556
)
> at de.spiritlink.lqa.om.BaseDepartment.save(BaseDepartment.java:527) at
> de.spiritlink.lqa.om.BaseDepartment.save(BaseDepartment.java:491) at
> de.spiritlink.lqa.om.BaseDepartment.save(BaseDepartment.java:471) at
>
de.spiritlink.lqa.web.struts.action.LoginAction.execute(LoginAction.java:66)
> at
>
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:484)
> at
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:165) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at
>
com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:9
6)
> at com.caucho.server.http.Invocation.service(Invocation.java:315) at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246) at
> com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
> at com.caucho.server.TcpConnection.run(TcpConnection.java:139) at
> java.lang.Thread.run(Thread.java:536)
>
> Because I need to continue developing, I tried to switch the idMethod to
> "idbroker".  However, this also doesn't work.
>
> Thanks!
>
> Steffen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>

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


Mime
View raw message