on 06-23-2004 3:13 PM
Hello,
how can i make the JDO Enhancer aware of the fact, that a class to be made persistent is a derived class from another class being made persistent by JDO ?
The classpath used for the enhancer currently contains everything from the JDO sample plus the path so it can pick up the base classes. I think it is missing the .jdo file for the Base class.
regards, udo
I've taken a look at the example. Is this discriminator really needed ?
I'm not trying to model different business-entities (Employee<->Manager) using this approach. What i'd like to achieve is a common base class for all persistent objects containing attributes for creationdate/modificationdate/deletiondate.
I don't like the discriminitator approach since then the datamodel would look very strange to me and is tricky for simple SQL-selects.
regards, Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Besides that the checker also complains about:
check.MySample:
[java] ... catalog path: ../TPB-DIC/gen_ddic/dbtables/
[java] javax.jdo.JDOFatalUserException: consistency check error for com.vw.tpb.node.model.MySample
[java] NestedThrowables:
[java] com.vw.tpb.node.model.MySample: check for PC Class failed / consistency check error for com.vw.tpb.node.model.MySample
[java] javax.jdo.JDOFatalUserException: no mapping metadata file found for class com.vw.tpb.core.model.AbstractPersistent
[java] at com.sap.jdo.sql.mapping.impl.MappingClassImpl.checkConsistency(MappingClassImpl.java:314)
[java] at com.sap.jdo.sql.mapping.impl.MappingModelImpl.getMappingClass(MappingModelImpl.java:304)
[java] at com.sap.jdo.sql.util.JDO.checkClasses(JDO.java:201)
[java] at com.sap.jdo.sql.util.JDO.process(JDO.java:423)
[java] at com.sap.jdo.sql.util.JDO.main(JDO.java:406)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Udo,
did you map the persistent base class and how do you map, to a single or separate tables? Please look at the possible options and prerequisites (including a sample) here: http://help.sap.com/saphelp_nw04/helpdata/en/96/aa2ced867f480780e13a8bf20314f9/content.htm
Regards
Stefan
Hello Stefan,
i do have my superclass declared as persistence-capable and provide a reference to the superclass in the derived class' .jdo.
Nevertheless the enhancer Task gives a:
enhance.MySample:
[java] com.sap.jdo.enhancer.meta.EnhancerMetaDataUserException: nested exception: com.sap.jdo.model.jdo.JDOModelException: Superclass 'com.vw.tpb.core.model.BasePersistent' of persistence-capable class 'com.vw.tpb.node.model.MySample' is not persistence-capable.
[java] at com.sap.jdo.enhancer.meta.model.EnhancerMetaDataJDOModelImpl.getJDOClass(EnhancerMetaDataJDOModelImpl.java:167)
[java] at com.sap.jdo.enhancer.meta.model.EnhancerMetaDataJDOModelImpl.isPersistenceCapableClass(EnhancerMetaDataJDOModelImpl.java:323)
[java] at com.sap.jdo.enhancer.core.Analyzer.initPersistenceType(Analyzer.java:595)
[java] at com.sap.jdo.enhancer.core.Analyzer.scan(Analyzer.java:517)
[java] at com.sap.jdo.enhancer.core.Controller.scan(Controller.java:169)
[java] at com.sap.jdo.enhancer.core.Controller.enhanceClass(Controller.java:124)
[java] at com.sap.jdo.enhancer.filter.Enhancer.enhanceClassFile1(Enhancer.java:185)
[java] at com.sap.jdo.enhancer.filter.Enhancer.enhanceClassFile(Enhancer.java:232)
[java] at com.sap.jdo.enhancer.Main.enhanceClassFile(Main.java:583)
[java] at com.sap.jdo.enhancer.Main.enhanceInputFiles(Main.java:539)
[java] at com.sap.jdo.enhancer.Main.process(Main.java:157)
[java] at com.sap.jdo.enhancer.Main.main(Main.java:117)
[java] Fatal error while enhancing: JDO ENHANCER: An internal error occurred while enhancing input class; detailed message: nested exception: com.sap.jdo.model.jdo.JDOModelException: Superclass 'com.vw.tpb.core.model.BasePersistent' of persistence-capable class 'com.vw.tpb.node.model.MySample' is not persistence-capable.
[java] aborted with errors.
[java] com.sap.jdo.enhancer.EnhancerFatalError: JDO ENHANCER: An internal error occurred while enhancing input class; detailed message: nested exception: com.sap.jdo.model.jdo.JDOModelException: Superclass 'com.vw.tpb.core.model.BasePersistent' of persistence-capable class 'com.vw.tpb.node.model.MySample' is not persistence-capable.
[java] at com.sap.jdo.enhancer.filter.Enhancer.enhanceClassFile(Enhancer.java:247)
[java] at com.sap.jdo.enhancer.Main.enhanceClassFile(Main.java:583)
[java] at com.sap.jdo.enhancer.Main.enhanceInputFiles(Main.java:539)
[java] at com.sap.jdo.enhancer.Main.process(Main.java:157)
[java] at com.sap.jdo.enhancer.Main.main(Main.java:117)
[java] BUILD FAILED: file:C:/NetWeaver/TPB-EJB/build.xml:226: Java returned: 1
Below are some snippets of both jdo files and the build.xml.
regards, Udo
-- Derived Class
<jdo>
<package name="com.vw.tpb.node.model">
<class name="MySample"
identity-type="application"
objectid-class="com.vw.tpb.node.model.MySample$Id"
persistence-capable-superclass="com.vw.tpb.core.model.BasePersistent"
> <!-- end class tag -->
-- Base class
<jdo>
<package name="com.vw.tpb.core.model">
<class name="BasePersistent"
identity-type="application"
> <!-- end class tag -->
-- ANT Build file tag to enhance the MySample is
<target name="enhance.MySample" depends="enhance.BasePersistent">
<java
fork="yes"
failonerror="yes"
classname="${jdo.enhancer}" classpathref="jdo.classpath">
<arg line= "-f -d" />
<arg value= "${bin.java.dir}" />
<arg value= "${src.java.dir}/com/vw/tpb/node/model/MySample.jdo" />
<arg value= "${bin.java.dir}/com/vw/tpb/node/model/MySample.class" />
</java>
</target>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Udo,
please have a look here: http://help.sap.com/saphelp_nw04/helpdata/en/6a/a6c9ff024843b3abeded4a530ad29c/content.htm
Snippet:
"For classes that have persistence capable superclasses, you must also add the persistence-capable-superclass attribute, which declares the fully qualified name of the persistence capable superclass."
Hope that helps.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.