Oh... What stupid I am!!!
really, I was using java.util.Date... I change it to java.sql.Date and all
works very fine!!!
Thanks for the support!!! Specially thanks to you Danilo for all.
[]´s

Ronald


----- Original Message -----
From: "Danilo Tommasina" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, November 04, 2003 12:16 PM
Subject: Re: Oracle Auto-Increment


> Uhm,
>
> I guess this has nothing to do with the sequence/auto-increment
features...
>
> I think the problem is with the DATE field:
>
> <field-descriptor
>
> name="nascimento"
>
> column="DATA"
>
> jdbc-type="DATE"
>
> />
>
> It is probably a conversion problem, are you using java.util.Date or
> java.sql.Date in your persistent class?
>
> i personally never use SQL Date type, i always use GMT time
> (java.util.Date.getTime()) to store dates in db, it makes the db entries
> less readable but better portable (same Date precision on all db
plattforms)
>
> bye
> danilo
>
> > Hi again...
> >
> > I´m using it behind a Jetspeed portal (I don´t know if it matter... ).
> > My Stack Trace is here:
> >
> > /////////////////////////////////////////////////////////////////////
> > java.lang.ClassCastException
> >         at
> > oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedSt
> > atement.java:2832)
> >         at
> > oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedSt
> > atement.java:2905)
> >         at
> > org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForState
> > ment(Unknown Source)
> >         at
> > org.apache.ojb.broker.platforms.PlatformOracleImpl.setObjectForStatem
> > ent(Unknown Source)
> >         at
> > org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(Unknown
> >  Source)
> >         at
> > org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknow
> > n Source)
> >         at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown So
> > urce)
> >         at
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source
> > )
> >         at
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source
> > )
> >         at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >         at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >         at
> > com.audaces.portal.modules.actions.core.aniversarios.AniversarianteAd
> > minJspPortletAction.doSave(AniversarianteAdminJspPortletAction.java:78)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> > java:39)
> >         at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> > sorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:324)
> >         at
> > org.apache.jetspeed.modules.actions.portlets.PortletActionEvent.fireE
> > vent(PortletActionEvent.java:215)
> >         at
> > org.apache.jetspeed.modules.actions.portlets.PortletActionEvent.execu
> > teEvents(PortletActionEvent.java:176)
> >         at
> > org.apache.jetspeed.modules.actions.portlets.GenericMVCAction.perform
> > (GenericMVCAction.java:148)
> >         at
> > org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:122)
> >         at
> > org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java
> > :143)
> >         at org.apache.turbine.modules.Page.build(Page.java:90)
> >         at
org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)
> >         at org.apache.turbine.Turbine.doGet(Turbine.java:563)
> >         at org.apache.turbine.Turbine.doPost(Turbine.java:658)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > icationFilterChain.java:247)
> >         at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > ilterChain.java:193)
> >         at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> > alve.java:256)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> > t.invokeNext(StandardPipeline.java:643)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> > a:480)
> >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> >
> >         at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> > alve.java:191)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> > t.invokeNext(StandardPipeline.java:643)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> > a:480)
> >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> >
> >         at
> > org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
> > 2415)
> >         at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> > ava:180)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> > t.invokeNext(StandardPipeline.java:643)
> >         at
> > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
> > rValve.java:171)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> > t.invokeNext(StandardPipeline.java:641)
> >         at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> > ava:172)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> > t.invokeNext(StandardPipeline.java:641)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> > a:480)
> >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> >
> >         at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> > ve.java:174)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> > t.invokeNext(StandardPipeline.java:643)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> > a:480)
> >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> >
> >         at
> > org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:22
> > 3)
> >         at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> > :594)
> >         at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
> > ssConnection(Http11Protocol.java:392)
> >         at
> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
> > :565)
> >         at
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
> > ool.java:619)
> >         at java.lang.Thread.run(Thread.java:534)
> >
> >
> > Thanks again....
> >
> > Ronald
> >
> >
> > ----- Original Message -----
> > From: "Danilo Tommasina" <[EMAIL PROTECTED]>
> > To: "OJB Users List" <[EMAIL PROTECTED]>
> > Sent: Tuesday, November 04, 2003 10:45 AM
> > Subject: Re: Oracle Auto-Increment
> >
> >
> >
> >>Hi Ronald,
> >>
> >>The descriptors seem ok to me, I am using autoCommit="2" and all
> >>auto-xxx attributes = false, however this should make no difference.
> >>
> >>Could you please post the stacktrace you get with batch mode OFF?
> >>If i remember well in rc4 there is still some problem with batch mode ON
> >>(should have been corrected in the CVS Head revision)
> >>
> >>bye
> >>danilo
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>And thanks for the quick response! :-)
> >>>Well, I try these setytings, but with batch mode Off, It gives me a
> >
> > java.lang.classCastException. And with Batch mode ON, it gives me a
ERROR:
> > Commit on underlying connection failed, try to rollback...
> >
> >>>These are my xml´s:
> >>>
> >>>Database:
> >>><jdbc-connection-descriptor
> >>>
> >>>jcd-alias="default"
> >>>
> >>>default-connection="true"
> >>>
> >>>platform="Oracle"
> >>>
> >>>jdbc-level="2.0"
> >>>
> >>>driver="oracle.jdbc.driver.OracleDriver"
> >>>
> >>>protocol="jdbc"
> >>>
> >>>subprotocol="oracle"
> >>>
> >>>dbalias="thin:@192.168.0.5:1521:dbserver"
> >>>
> >>>username="...
> >>>
> >>>password="...
> >>>
> >>>eager-release="false"
> >>>
> >>>batch-mode="true"
> >>>
> >>>useAutoCommit="1"
> >>>
> >>>ignoreAutoCommitExceptions="false"
> >>>
> >>>
> >>>
> >>>
> >>><connection-pool maxActive="5" validationQuery=""/>
> >>>
> >>>
> >>><sequence-manager
> >
> >
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl" >
> >
> >>><attribute attribute-name="autoNaming" attribute-value="false"/>
> >>>
> >>></sequence-manager>
> >>>
> >>>
> >>>
> >>>And user.xml :
> >>>
> >>><field-descriptor
> >>>
> >>>id="1"
> >>>
> >>>name="id"
> >>>
> >>>column="ID"
> >>>
> >>>jdbc-type="INTEGER"
> >>>
> >>>nullable="false"
> >>>
> >>>primarykey="true"
> >>>
> >>>autoincrement="true"
> >>>
> >>>sequence-name="SEQ_ANIVER"
> >>>
> >>>length="22"
> >>>
> >>>/>
> >>>
> >>><field-descriptor
> >>>
> >>>name="nome"
> >>>
> >>>column="NOME"
> >>>
> >>>jdbc-type="VARCHAR"
> >>>
> >>>/>
> >>>
> >>><field-descriptor
> >>>
> >>>name="nascimento"
> >>>
> >>>column="DATA"
> >>>
> >>>jdbc-type="DATE"
> >>>
> >>>/>
> >>>
> >>></class-descriptor>
> >>>
> >>>
> >>>
> >>>Thanks.,..
> >>>
> >>>
> >>>
> >>>Ronald
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>----- Original Message -----
> >>>From: "Danilo Tommasina" <[EMAIL PROTECTED]>
> >>>To: "OJB Users List" <[EMAIL PROTECTED]>
> >>>Sent: Tuesday, October 28, 2003 1:37 PM
> >>>Subject: Re: Oracle Auto-Increment
> >>>
> >>>
> >>>
> >>>
> >>>>hi Ronald (sorry i misspelled your name before)
> >>>>
> >>>>As long as i know Oracle has ROW ID fields and I meant you were using
> >>>>these ones as auto-increment.
> >>>>
> >>>>We use Oracle-sequences for Id auto-generation, these must be
generated
> >>>>by your DBAs and you need to know wht is the name of the sequences
they
> >>>>generated.
> >>>>In your repository.xml you assign sequences to your columns, as
follows:
> >>>>
> >>>><field-descriptor
> >>>>   id="1"
> >>>>   name="fieldName"
> >>>>   column="columnName"
> >>>>   jdbc-type="DECIMAL"
> >>>>   nullable="false"
> >>>>   primarykey="true"
> >>>>   autoincrement="true"
> >>>>   sequence-name="SEQUENCE_NAME_FOR_TABLE"
> >>>>   length="22"
> >>>>/>
> >>>>
> >>>>Also add following XML as inner-tag in 'jdbc-descriptor' tag.
> >>>>
> >>>><sequence-manager
> >>
>
>>>className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl
"
> >>
> >>>>    <attribute attribute-name="autoNaming" attribute-value="false"/>
> >>>></sequence-manager>
> >>>>
> >>>>cheers
> >>>>danilo
> >>>>
> >>>>
> >>>>
> >>>>>Hi Danilo,
> >>>>>
> >>>>>I will try to explain a little better (forgive the errors... I´m
> >>>>>brazillian... hehe :-)
> >>>>>First: I´m not a DB expert.
> >>>>>The DBA have done the all the sequences. They work perfect outside
OJB.
> >>>>>Well, considering that I have a Oracle Database Setup and OK, with
> >
> > sequences
> >
> >>>>>and all... right?
> >>>>>My doubt is on OJB, when I try to use the store() method I get an
> >>>>>java.lang.ClassCastException.
> >>>>>Can you send the pieces of the repository_user and
repository_database
> >
> > to
> >
> >>>>>me?
> >>>>>I think my error is there, because the database is already in use at
a
> >
> > long
> >
> >>>>>time, without problems in a Client/Server application.
> >>>>>You can do that?
> >>>>>
> >>>>>Thanks for the support!!!
> >>>>>[]´s
> >>>>>
> >>>>>Ronald
> >>>>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to