Fornax-Platform
Forum

Re: Hibernate Version 1.9.0 - Questions concerning schema export

by Darius Jockel :: Rate this Message:

Reply to Author | View in Thread

Hello Klaus Müller,

Klaus Mueller wrote:
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").
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.
This is a 'small' error. I will fix it.

Klaus Mueller wrote:
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.
You are right. The flag textOnly is not used. The SchemaExport Class only generates a .ddl .

Klaus Mueller wrote:
Moreover a part of the method is commented.
There are problems configuring the SchemaExport by the Hibernate Config File "hibernate.cfg.xml" in some rare cases.
So we decided to configure the SchmaExport by hand by adding all classes manually.

Regards
Darius

 « Return to Thread: Hibernate Version 1.9.0 - Questions concerning schema export