S Sayer

Greenhorn
+ Follow
since Apr 15, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by S Sayer

I have been trying to convert my POJO's from single column primary keys (which compiles fine with hbm2java) to composite keys. Now when I try and create the POJO from the mapping I get a ClassDefNotFoundException.

The name of the hbm file and the POJO are different (I did this because I was getting exceptions due to different packages, and it worked fine with single column PK's).

NOTE: I cannot generate my own ID as I am working with a database that I have no admin privileges over.

I'm trying to follow the 24.4.2 example in the Hibernate documentation.

Cheers -

Hibernate version: 3.0.5, HibernateTools alpha4

[b]Mapping documents:
CurrRipaEtgMpcDAOImpl.hbm.xml


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/HibernateMapping DTD3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

<class name="com.excellus.arthr.model.op.CurrRipaEtgMpc" table="RIPARPT.T_ETGMPC">
<meta attribute="implement-equals">true</meta>
<meta attribute="class-description">
Represents the T_ETGMPC table in the database.
@author ssayer
@version 1.0
</meta>

<composite-id name="id"
class="com.excellus.arthr.model.op.CurrRipaEtgMpc">
<key-property name="mpcno"/>
<key-property name="specialty"/>
</composite-id>

<property name="mpcno" type="string"/>
<property name="specialty" type="string"/>

</class>
</hibernate-mapping>

Full stack trace of any exception that occurs:

[hbm2java] org.hibernate.MappingException: Could not configure datastore from file: C:\Documents and Settings\ssayer\My Documents\IBM\wsappdevie51\workspace\arthr-model-op-hibernate\com\excellus\arthr\model\op\hibernate\CurrRipaEtgMpcDAOImpl.hbm.xml
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at org.hibernate.exception.NestableRuntimeException.<init>(NestableRuntimeException.java:124)
[hbm2java] at org.hibernate.cfg.Configuration.addFile(Configuration.java:249)
[hbm2java] at org.hibernate.tool.hbm2java.CodeGenerator.parseFiles(CodeGenerator.java:110)
[hbm2java] at org.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:95)
[hbm2java] at org.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145)
[hbm2java] at org.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95)
[hbm2java] at org.apache.tools.ant.Task.perform(Task.java:341)
[hbm2java] at org.apache.tools.ant.Target.execute(Target.java:309)
[hbm2java] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[hbm2java] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[hbm2java] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:571)
[hbm2java] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:367)
[hbm2java] at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:199)
[hbm2java] at java.lang.reflect.Method.invoke(Method.java)
[hbm2java] at org.eclipse.ant.core.AntRunner.run(AntRunner.java:335)
[hbm2java] at org.eclipse.ui.externaltools.internal.ant.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:172)
[hbm2java] at java.lang.Thread.run(Thread.java:795)
[hbm2java] Caused by: org.hibernate.MappingException: class com.excellus.arthr.model.op.CurrRipaEtgMpc not found while looking for property: mpcno
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at org.hibernate.exception.NestableRuntimeException.<init>(NestableRuntimeException.java:124)
[hbm2java] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[hbm2java] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[hbm2java] at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:1841)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindComponent(HbmBinder.java:1602)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindCompositeId(HbmBinder.java:1490)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindCompositeId(HbmBinder.java:383)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:298)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[hbm2java] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[hbm2java] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
[hbm2java] at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
[hbm2java] ... 15 more
[hbm2java] Caused by: java.lang.ClassNotFoundException: com.excellus.arthr.model.op.CurrRipaEtgMpc
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java)
[hbm2java] at java.lang.Class.forNameImpl(Native Method)
[hbm2java] at java.lang.Class.forName(Class.java)
[hbm2java] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[hbm2java] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
[hbm2java] ... 26 more
Thanks for your help everyone, this should do it.

18 years ago
Thanks for the suggestion, I probably should have specified that the solution must be compatible with J2SE/J2EE 1.3. Unforunately, the management packages were added in 1.4.

I considered using a Struts PlugIn, but my manager is against the idea of coupling instantiation with Struts.
18 years ago
Is there a way to instantiate objects upon server startup that is independent of the J2EE server? Some sort of ServerStartupListener (either in the Java API or custom made)?
18 years ago
I have my .hbm.xml, .cfg.xml files and my DAO Objects in one folder, and my POJO's located in another folder (different packages, in different eclipse projects--it has to stay this way). When I try and load the data from the database, my .hbm.xml files cannot be located and a MappingException is thrown.
Can anyone point me to a good tutorial on how to generate persistent classes using an Ant build file? I have the Hibernate Developer's Notebook, but it hasn't been much help.
I just went through the Enterprise Java Tutorial up until the point where it tells you to run your own J2EE applications. I went to fire up eclipse and add the .JAR files, but got the

JVM Terminated
exit code=11
(sorry it won't let me cut and paste it all)

There's probably a simple solution, but I am new to OS X and am unsure how to go about fixing. I searched google and could not find a fix for this particular JVM error.
18 years ago