facebook

Hibernate reverse engineering problem

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #297865 Reply

    terinchu
    Member

    Hi
    I’m trying to use reverse engineering in a project with spring and hibernate support, but in the process i receive the following message:

    An internal error occurred during: "Generating Artifacts".
    Association cl.implementa.springproject.persistencia.mapeo.Perfil.perfilUsuarios references unmapped class: cl.implementa.springproject.persistencia.mapeo.PerfilUsuario
    

    That’s the instalation details:

    *** Date: 
    viernes 24 de abril de 2009 01:16:41 PM CLT
    
    ** System properties:
    OS=WindowsXP
    OS version=5.1.0
    Java version=1.5.0_11
    
    
    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 7.0
    Build id: 7.0-20081201
    
    
    *** Eclipse details:
    MyEclipse Enterprise Workbench
    
    Version: 7.0
    Build id: 7.0-20081201
    
    
    
    
    Eclipse Platform
    
    Version: 3.4.1.r341_v20080731-9I96EiDElYevwz-p1bP5z-NlAaP7vtX6Utotqsu
    Build id: M20080911-1700
    
    
    Eclipse Java Development Tools
    
    Version: 3.4.1.r341_v20080709-0800-7o7tEAfEF_U5qyUgrb2HAp539P97
    Build id: M20080709-0800
    
    
    Eclipse Graphical Editing Framework GEF
    
    Version: 3.4.1.v20080806-67718083A56B4H2A3213573
    Build id: 200809101400
    
    
    Eclipse RCP
    
    Version: 3.4.100.r341_v20080814-989JESIEdAciFYfkZZsBfSwQ2341
    Build id: M20080703-0800
    
    
    Eclipse Plug-in Development Environment
    
    Version: 3.4.1.r341_v20080731-7T7U0E9mlRIuGUYviF_VP
    Build id: M20080703-0800
    
    
    
    
    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -showsplash
    -launcher
    C:\Program Files\Genuitec\MyEclipse 7.0\myeclipse.exe
    -name
    Myeclipse
    --launcher.library
    C:\Program Files\Genuitec\MyEclipse 7.0\../Common\plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731\eclipse_1115.dll
    -startup
    C:\Program Files\Genuitec\MyEclipse 7.0\../Common\plugins\org.eclipse.equinox.launcher_1.0.101.R34x_v20080819.jar
    -clean
    -configuration
    configuration
    -vm
    C:\Program Files\Genuitec\Common\binary\com.sun.java.jre.win32.x86_1.5.0.011\bin\client\jvm.dll
    
    

    the log error:

    
    !ENTRY org.eclipse.core.jobs 4 2 2009-04-24 13:15:02.031
    !MESSAGE An internal error occurred during: "Generating Artifacts".
    !STACK 0
    org.hibernate.MappingException: Association cl.implementa.springproject.persistencia.mapeo.Perfil.perfilUsuarios references unmapped class: cl.implementa.springproject.persistencia.mapeo.PerfilUsuario
        at org.hibernate.cfg.JDBCBinder.bindCollectionSecondPass(JDBCBinder.java:917)
        at org.hibernate.cfg.JDBCBinder$JDBCCollectionSecondPass.secondPass(JDBCBinder.java:939)
        at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
        at org.hibernate.cfg.JDBCBinder$JDBCCollectionSecondPass.doSecondPass(JDBCBinder.java:951)
        at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
        at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$7.execute(GenerateArtifactsJob.java:878)
        at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
        at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:91)
        at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:858)
        at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:405)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
    

    and the application context(auto-generated by “add hibernate capabilities”)

    <?xml version="1.0" encoding="UTF-8"?>
    <beans
        xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
    
        <bean id="miDataSource"
            class="org.apache.commons.dbcp.BasicDataSource">
            <property name="driverClassName"
                value="org.postgresql.Driver">
            </property>
            <property name="url"
                value="jdbc:postgresql://localhost:5432/sistema">
            </property>
            <property name="username" value="postgres"></property>
            <property name="password" value="postgres"></property>
        </bean>
        <bean id="miFabricaDeSesiones"
            class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <property name="dataSource">
                <ref bean="miDataSource" />
            </property>
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.dialect">
                        org.hibernate.dialect.PostgreSQLDialect
                    </prop>
                </props>
            </property>
            <property name="mappingResources">
                <list></list>
            </property>
        </bean>
    </beans>

    The mapping table is so simple, exists 2 tables, “profile” and “user” and i want a “many to many” relationship between the tables, so i put a “userProfile” table with theirs respectives foreign keys. When i use rev. engineering in the tables, the error ocurrs, but if i delete the “userProfile” table and only work with the others, do the process correctly.
    By the way, i use postgresql-8.3.7-1 and postgresql-8.3-604.jdbc3.jar
    Any help will be useful. Thanks

    #297871 Reply

    terinchu
    Member

    Also i found another problem
    I don’t know if is related with the later, but in any case…
    I deleted all the foreign keys in the tables to view how reach the rev. eng.
    Now, the problem is that not all the tables were mapped. Of 27 tables only 11 were mapped. I tried to found some pattern in the mapped tables, but i don’t had a single clue.

    I think that this would be related with the previous error message:

    An internal error occurred during: "Generating Artifacts".
    Association cl.implementa.springproject.persistencia.mapeo.Perfil.perfilUsuarios references unmapped class: cl.implementa.springproject.persistencia.mapeo.PerfilUsuario 

    because the “perfil” and “usuario” table was mapped but the “perfilUsuario” wasn’t next to delete all the foreign keys.
    I’ll wait any comments. Thanks

    #297872 Reply

    terinchu
    Member

    Well… i tried another thing
    I put foreign keys in the created tables and the mapping was correctly done.
    Now the question is why in some tables the rev. eng. works and in others not.
    I viewed this same problem in another posts about the same topic (references unmapped class) but seems not be the same problem as mine.
    Thanks in advance

    #298168 Reply

    support-joy
    Member

    terinchu,
    I could not replicate this issue with many to many relationship. can you send your database schema or the table structure so that i can try to reproduce from my end
    i would also recommend you to cross post to hibernate forums.

    #298234 Reply

    terinchu
    Member

    Hi
    Look that backup files:
    http://rapidshare.com/files/229988874/db-withoutFK.backup.html
    http://rapidshare.com/files/229989804/db-withFK.backup.html

    The first backup has 3 tables “user”, “profile” and a 3rd table with the “many to many” relationship, but without the foreign keys defined yet.
    To apply the rev.eng. in these tables, just “user” and “profile” were mapped.

    Next, in the second backup, the foreign keys were defined, then now when i apply the rev.eng., throws the “Association references unmapped class” exception.

    Anyway, i finished the mapping manually, but could be helpful know the reason of all that.
    Greetings.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Hibernate reverse engineering problem

You must be logged in to post in the forum log in