-----Original Message-----
From: Vaneet Sharma [mailto:[EMAIL PROTECTED]]
Sent: 12 June 2002 11:23
To: [EMAIL PROTECTED]
Subject: [castor-dev] can anybody solve my problem

hi , all
  i am asking questions from a user, when i ask one question.. my code works fine.. when i ask more than question.. i get an exception.
  each question has many answerbundles (it contains questionid and answer to each question as well action to that question), now this answer bundle can have one answer and many actions.
my classes and mapping files are attached ............ please see to it........ chao 
 
  THE ERROR is below
 
Answer Index 1AnswerId 85Answer NameYesRegular Expression yes
AnswerBundleid 100
Answer Index 2AnswerId 83Answer NameNoRegular Expression No
AnswerBundleid 101
Answer Index 3AnswerId 84Answer NameOpenRegular Expression [:print:]*
AnswerBundleid 102
VALUE OF COUNTER 3
Answer Index 1AnswerId 88Answer NameOpenRegular Expression [:print:]*
AnswerBundleid 103

org.exolab.castor.jdo.PersistenceException: The object of type com.iwg.imodel.ad
min.Answer with identity 88 is already persistent -- cannot make a persistent ob
ject persisted twice
        at org.exolab.castor.persist.TransactionContext.markCreate(TransactionCo
ntext.java:684)
        at org.exolab.castor.persist.TransactionContext.create(TransactionContex
t.java:774)
        at org.exolab.castor.jdo.engine.DatabaseImpl.create(DatabaseImpl.java:33
8)
        at com.iwg.imodel.admin.CreateHotmeter.createHotmeterEvent(CreateHotmete
r.java:208)
        at com.iwg.imodel.admin.SurveyManager.addSurvey(SurveyManager.java:73)
        at com.iwg.imodel.admin.NewSurvey.handleRequest(NewSurvey.java:212)
        at org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet
.java:331)
        at org.apache.velocity.servlet.VelocityServlet.doPost(VelocityServlet.ja
va:301)
        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 com.oreilly.servlet.MultipartFilter.doFilter(MultipartFilter.java:57)
 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:213)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:190)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2343)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
468)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:1012)
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1107)
        at java.lang.Thread.run(Thread.java:484)
 
 
 
-----Original Message-----
From: qm [mailto:[EMAIL PROTECTED]]
Sent: 12 June 2002 07:58
To: [EMAIL PROTECTED]
Subject: [castor-dev] An advice on the HIGH/LOW key-generator

 
 

I used the HIGH/LOW key-generator to improve the performance under the concurrency. 
But there happen to be an underneath error, when the key_value in the key-table is lower than the actual key value in the correpondent table. 
for exampl, I have a table named employee, the max identity is 1000. The HIGH/LOW key-generator talbe is called keys, there is a record "employee     10".  And the indentity "11" is already existed in the table employee. 
Then, the db.create(employee) is invoked, another Employee object with the indentity "11" is created in the table employee, not any exception including the DuplicatedIndentity is thrown, so the error happens.
 
My advice is the DuplicatedIndentity should be thrown.

Reply via email to