cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joose Vettenranta <jo...@iki.fi>
Subject Re: ojb + forms = I can't get it to work
Date Wed, 21 Jul 2004 06:21:19 GMT
Hi,

20.7.2004 kello 21:02, Tony Collen kirjoitti:

  Joose Vettenranta wrote:
>> WEll, the story continues.. I was able to enhance that class and it  
>> did make it to work.. Well, but I got a new error, so the sequal of  
>> this story is about to be reveiled:
>> The new story is called:
>> org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException:  
>> Can not init Identity for given object
> I could be totally wrong since I haven't done a lot of OJB stuff, but  
> I think it has to do with your database table not having a unique key  
> field.

This is not the case.

in postgresql I created the database like this:
create table category (
  id serial,
  parent integer,
primary key(id),
foreign key(parent) references category(id)
);

I tried also with create index but that didn't help. So there is unique  
key in database!

I didn't find how I could define jdo something as unique or  
autoincrement or as index, so I just have:

   <class name="Category" identity-type="datastore">
    <extension vendor-name="ojb" key="table" value="product_categories"/>
    <field name="id" persistence-modifier="persistent">
     <extension vendor-name="ojb" key="column" value="id"/>
    </field>
    <field name="parent" persistence-modifier="persistent">
     <extension vendor-name="ojb" key="column" value="parent"/>
    </field>
   </class>


I think the problem might be in repository.xml or something like that.

in repository.xml I have:

     <class-descriptor class="net.vettenranta.Category"  
table="product_categories">
         <field-descriptor name="id"
                           jdbc-type="INTEGER"
                           primarykey="true"
                           default-fetch="true"
                           access="readonly"
                           autoincrement="true"
                           indexed="true"
                           sequence-name="product_categories_id_seq"
                           column="id" />
         <field-descriptor name="parent" column="parent"  
jdbc-type="INTEGER"/>
     </class-descriptor>

if I take "autoincrement" away, it works, but doesn't get the id of the  
row just inserted. And when using autoincrement="true" I get:
----
org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can  
not init Identity for given object  
net.vettenranta.category.bean.Category@637194d
...
Caused by: org.apache.ojb.broker.PersistenceBrokerException: Could not  
get key value
Caused by: org.apache.ojb.broker.util.sequence.SequenceManagerException:
Could not grab next id, failed with
This feature is not supported by this implementation
Creation of new sequence failed with
This feature is not supported by this implementation
...
Caused by: java.lang.UnsupportedOperationException: This feature is not  
supported by this implementation
-----


see full stacktrace below:

Original Exception:  
org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can  
not init Identity for given object  
net.vettenranta.category.bean.Category@637194d
         at org.apache.ojb.broker.Identity.init(Identity.java:125)
         at org.apache.ojb.broker.Identity.<init>(Identity.java:82)
         at  
org.apache.ojb.jdori.sql.OjbStoreManager.createObjectId(OjbStoreManager. 
java:223)
         at  
com.sun.jdori.common.state.StateManagerImpl.initializeSM(Unknown  
Source)
         at  
com.sun.jdori.common.state.StateManagerImpl.makePersistent(Unknown  
Source)
         at com.sun.jdori.common.CacheManagerImpl.makePersistent(Unknown  
Source)
         at  
com.sun.jdori.common.PersistenceManagerImpl.makePersistentInternal(Unkno 
wn Source)
         at  
com.sun.jdori.common.PersistenceManagerImpl.makePersistent(Unknown  
Source)
         at  
com.sun.jdori.common.PersistenceManagerWrapper.makePersistent(Unknown  
Source)
         at  
net.vettenranta.category.CategoryDAO.insert(CategoryDAO.java:46)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at  
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav 
a:79)
         at  
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor 
Impl.java(Compiled Code))
         at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
         at  
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:230)
         at  
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
         at  
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(C 
ontinuationInterpreter.java:1134)
         at  
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(C 
ontinuationInterpreter.java:190)
         at  
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(C 
ontinuationInterpreter.java:138)
         at  
org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(Interp 
retedFunctionImpl.java:121)
         at  
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
         at  
org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java 
:1591)
         at  
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpret 
er.handleContinuation(FOM_JavaScriptInterpreter.java:788)
         at  
org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invo 
ke(CallFunctionNode.java:120)
         at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:49)
         at  
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i 
nvoke(PreparableMatchNode.java:130)
         at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:72)
         at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P 
ipelineNode.java:126)
         at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:72)
         at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke( 
PipelinesNode.java:101)
         at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:336)
         at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:277)
         at  
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(Moun 
tNode.java:103)
         at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:49)
         at  
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i 
nvoke(PreparableMatchNode.java:130)
         at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:72)
         at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P 
ipelineNode.java:126)
         at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:72)
         at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke( 
PipelinesNode.java:101)
         at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:336)
         at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:277)
         at org.apache.cocoon.Cocoon.process(Cocoon.java:639)
         at  
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java: 
1098)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at  
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:354)
         at  
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH 
andler.java:294)
         at  
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java: 
567)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
         at  
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon 
text.java:525)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
         at org.mortbay.http.HttpServer.service(HttpServer.java:879)
         at  
org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
         at  
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
         at  
org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
         at  
org.mortbay.http.SocketListener.handleConnection(SocketListener.java: 
197)
         at  
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
         at  
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:501)
Caused by: org.apache.ojb.broker.PersistenceBrokerException: Could not  
get key value
         at  
org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(BrokerHelp 
er.java:315)
         at  
org.apache.ojb.broker.util.BrokerHelper.getValuesForObject(BrokerHelper. 
java:347)
         at  
org.apache.ojb.broker.util.BrokerHelper.getKeyValues(BrokerHelper.java: 
173)
         at org.apache.ojb.broker.Identity.init(Identity.java:118)
         ... 56 more
Caused by: org.apache.ojb.broker.util.sequence.SequenceManagerException:
Could not grab next id, failed with
This feature is not supported by this implementation
Creation of new sequence failed with
This feature is not supported by this implementation

         at  
org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl.getUnique 
Long(SequenceManagerNextValImpl.java:135)
         at  
org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueVal 
ue(AbstractSequenceManager.java:128)
         at  
org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(BrokerHelp 
er.java:302)
         ... 59 more
Caused by: java.lang.UnsupportedOperationException: This feature is not  
supported by this implementation
         at  
org.apache.ojb.broker.platforms.PlatformDefaultImpl.createSequenceQuery( 
PlatformDefaultImpl.java:264)
         at  
org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl.createSeq 
uence(SequenceManagerNextValImpl.java:201)
         at  
org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl.getUnique 
Long(SequenceManagerNextValImpl.java:131)
         ... 61 more


- Joose

--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message