Hello,
I tried to use the hibernate cartridge in conjunction with the feature
"schemaExport" and now there are some
issues I wonder about.
First of all I get a MappingNotFoundException using both the features
"schemaExport" and "pojo",
as long as I actually specify a pojo.package (like "pojo"). Here is a part
of the output after running the workflow (don't
wonder about the expressionless package name):
...
12047 INFO Configuration - Reading mappings from file:
.\src\generated\resources\de\fh\StudentImpl.hbm.xml
org.hibernate.MappingNotFoundException: file:
.\src\generated\resources\de\fh\StudentImpl.hbm.xml not found
at org.hibernate.cfg.Configuration.addFile(Configuration.java:307)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:293)
at org.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:381)
at
org.fornax.cartridges.uml2.hibernate.SchemaExporter.invokeInternal(SchemaExporter.java:93)
at
org.openarchitectureware.workflow.lib.AbstractWorkflowComponent2.invoke(AbstractWorkflowComponent2.java:61)
at
org.openarchitectureware.workflow.container.ConditionalComponent.internalInvoke(ConditionalComponent.java:57)
at
org.openarchitectureware.workflow.container.ConditionalComponent.invoke(ConditionalComponent.java:39)
at
org.openarchitectureware.workflow.container.CompositeComponent.internalInvoke(CompositeComponent.java:129)
at
org.openarchitectureware.workflow.container.CompositeComponent.invoke(CompositeComponent.java:112)
at
org.openarchitectureware.workflow.container.CompositeComponent.internalInvoke(CompositeComponent.java:129)
at
org.openarchitectureware.workflow.container.CompositeComponent.invoke(CompositeComponent.java:112)
at
org.openarchitectureware.workflow.WorkflowRunner.executeWorkflow(WorkflowRunner.java:380)
at
org.openarchitectureware.workflow.WorkflowRunner.run(WorkflowRunner.java:261)
at
org.openarchitectureware.workflow.WorkflowRunner.main(WorkflowRunner.java:213)
In fact this file does not exist. After this I had a look at the file
org.fornax.cartridges.uml2.hibernate.SchemaExporter. There I found the
method addHbmFiles, which contains the
following line:
String qn = srcRes +"/"+ Helper.getFQNPackagePath(entity)+"/"
+entity.getName()+"Impl.hbm.xml";
In my case the method invocation Helper.getFQNPackagePath(entity) returns
"de/fh". Therefore qn has the value
"./src/generated/resources/de/fh/StudentImpl.hbm.xml". The fact that I'm
using a pojo package is not
taken into account. Of course this problem is not difficult to solve, as I
can simply leave the pojo.package
empty or disable the pojo feature, but nevertheless I would like to know
whether this behaviour serves a special
purpose or whether it is simply a small error.
To be able to continue testing the hibernate cartridge I left the
pojo.package empty. As I want the cartridge to
actually export the script to the database, I adjusted the file
hibernate.oaw
(org.fornax.cartridges.uml2.hibernate). My SchemaExport component now looks
like this:
<!--The SchemaExprot component. the schema export is invoced here-->
<feature isSelected="schemaExport">
<component id="SchemaExport"
class="org.fornax.cartridges.uml2.hibernate.SchemaExporter">
<modelSlot value="${hibernate.modelslot}" />
<srcRes value="${outlet.res.dir}" />
<textOnly value="false" />
<propertiesFile
value="${outlet.res.dir}/hibernate.properties"
/>
</component>
</feature>
As you can see I only added the textOnly-Element and set it to false. By
default textOnly is set to true
and the documentation says that it means that the cartridge doesn't export
to database.
After running the workflow again everything seems to work fine, but the
schema is not exported to the
database. Following is a part of the output:
15641 INFO ConditionalComponent - SchemaExporter(SchemaExport)
...
15875 INFO Configuration - Reading mappings from file:
.\src\generated\resources\de\fh\StudentImpl.hbm.xml
16078 INFO HbmBinder - Mapping class: de.fh.StudentImpl ->
TB_STUDENT
...
16469 INFO SchemaExport - Running hbm2ddl schema export
16469 INFO SchemaExport - writing generated schema to file:
./src/generated/resources/Data.ddl
16484 INFO SchemaExport - schema export complete
After this I had a look at the SchemaExport again. I was a bit surprised,
due to the fact that inside
of the method invokeInternal, the parameter "--text" is set - not depending
on the value of textOnly.
Moreover a part of the method is commented. This part would call the export
method and actually
export the script to the database. Do I to get the wrong end of the stick or
does the method invokeInternal
never export the script to the database (no matter what is specified in the
SchemaExport component)?.
Please let me know what I got wrong.
At the moment I changed the implementation to call the export-method every
time, as I want to export
the script to the database every time (at least at the moment, as there will
be frequent changes at the beginning).
Is there another way to do this, did I miss to specify something or did I
get another part wrong?
Thank you in advance.
Regards,
Klaus
--
View this message in context:
http://www.nabble.com/Hibernate-Version-1.9.0---Questions-concerning-schema-export-tp23383451s17564p23383451.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer