-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: [ middlegen ] association
PostPosted: Wed Jul 20, 2005 5:15 pm 
Beginner
Beginner

Joined: Fri Apr 23, 2004 6:39 pm
Posts: 23
Bonjour,

J'essai de générer des fihiers de mapping a partir de mon schema de base de donnée en utilisant middlegen. Il génere bien toute les associations dans le fichier de mapping sauf une association:



Quote:
BUILD FAILED
F:\hibernate-2.1.2\Middlegen-Hibernate-r5\Middlegen-Hibernate-r5\build.xml:149:
java.lang.IllegalArgumentException: There is no column named util in the table named utilisateur2


voici mon script sql :

alter table UTILISATEUR2_ROLES drop constraint FK9C293F8DB8D66786;
alter table UTILISATEUR2_ROLES drop constraint FK9C293F8DB8D4FC31;
alter table UTILISATEUR2 drop constraint FK4FCF252F3472F6;
alter table CONNEXIONS drop constraint FKEFD16ECA36F002;
drop table ROLES;
drop table UTILISATEUR2_ROLES;
drop table UTILISATEUR2;
drop table CONNEXIONS;
drop table PERSONNES;
drop sequence hibernate_sequence;
create table ROLES (
idRole INT8 not null,
nom VARCHAR(255),
primary key (idRole)
);
create table UTILISATEUR2_ROLES (
idUser INT8 not null,
idRole INT8 not null,
primary key (idRole, idUser)
);
create table UTILISATEUR2 (
idUser INT8 not null,
login VARCHAR(255),
password VARCHAR(255),
datecm TIMESTAMP,
issuprimable INT4,
pers INT8 not null,
primary key (idUser)
);
create table CONNEXIONS (
idCnx INT8 not null,
dateDeb DATE,
dateFin DATE,
util INT8 not null,
primary key (idCnx)
);
create table PERSONNES (
idPers INT8 not null,
sousclasse CHAR(1) not null,
nom VARCHAR(255),
prenom VARCHAR(255),
codeInterne VARCHAR(255),
societe VARCHAR(255),
primary key (idPers)
);
alter table UTILISATEUR2_ROLES add constraint FK9C293F8DB8D66786 foreign key (idUser) references UTILISATEUR2;
alter table UTILISATEUR2_ROLES add constraint FK9C293F8DB8D4FC31 foreign key (idRole) references ROLES;
alter table UTILISATEUR2 add constraint FK4FCF252F3472F6 foreign key (pers) references PERSONNES;
alter table CONNEXIONS add constraint FKEFD16ECA36F002 foreign key (util) references UTILISATEUR2;
create sequence hibernate_sequence;


Merci


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 20, 2005 9:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Not sure what configuration is in the build.xml Ant task but the error is correct. Don't use table tags etc and see what happens.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 1:26 pm 
Beginner
Beginner

Joined: Fri Apr 23, 2004 6:39 pm
Posts: 23
Thanks for your response. I have omment all tags table, but it appears the same errors. Here the target in build.xml :

Code:
      <taskdef
         name="middlegen"
         classname="middlegen.MiddlegenTask"
         classpathref="lib.class.path"
      />

      <middlegen
         appname="${name}"
         prefsdir="${src.dir}"
         gui="${gui}"
         databaseurl="${database.url}"
         initialContextFactory="${java.naming.factory.initial}"
         providerURL="${java.naming.provider.url}"
         datasourceJNDIName="${datasource.jndi.name}"
         driver="${database.driver}"
         username="${database.userid}"
         password="${database.password}"
         schema="${database.schema}"
         catalog="${database.catalog}"
        
      >

         <!--
         We can specify what tables we want Data generated for.
         If none are specified, Data will be generated for all tables.
         Comment out the <table> elements if you want to generate for all tables.
         Also note that table names are CASE SENSITIVE for certain databases,
         so on e.g. Oracle you should specify table names in upper case.
         -->
   <!-- <table generate="true" name="UTILISATEUR2" pktable="idUser"/>
         <table generate="true" name="PERSONNES" pktable="idPers"/>
      <table generate="true" name="ROLES" pktable="idRole"/>
      <table generate="true" name="CONNEXIONS" pktable="idCnx"/>      
      <table generate="true" name="BORDEREAUX" pktable="id,numero,libelle"/>
      <table generate="true" name="TITRE" pktable="id"/>
   -->
      <!--
         If you want m:n relations, they must be specified like this.
         Note that tables declare in multiple locations must all have
         the same value of the generate attribute.
         -->
      <!--
     <many2many>
            <tablea name="UTILISATEUR2"/>
            <jointable name="UTILISATEUR2_ROLES" generate="false"/>
            <tableb  name="ROLES"/>
         </many2many>
   -->
         <!-- Plugins - Only Hibernate Plugin has been included with this special distribution  -->
         
         <!--
         If you want to generate XDoclet markup for hbm2java to include in the POJOs then
         set genXDocletTags to true. Also, composite keys are generated as external classes which is
         recommended. If you wish to keep them internal then set genIntergratedCompositeKeys to true.
         Since r4 the ability to customise the selection of JavaTypes is now provided. The is a
         recommended type mapper provided as shown. It is optional - if not provided then Middlegen
         itself will select the Java mapping (as it did previously).
         These settings are optional thus if they are not define here values default to false.
         -->
         <hibernate
            destination="${build.gen-src.dir}"
            package="utilisateur2"
            genXDocletTags="true"
            genIntergratedCompositeKeys="false"
            javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
      
         />
         
      </middlegen>

      <mkdir dir="${build.classes.dir}"/>
   </target>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 9:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I don't know whats up. The error message is clear and its also clear your table definitions does not have a user field in that table (or any table for that matter). The only thing that indicates what you showing here is incomplete are the last two constraints which would not be applied, eg,

Quote:
alter table CONNEXIONS add constraint FKEFD16ECA36F002 foreign key (util) references UTILISATEUR2;


Does not fit the table structure your showing (as does the constraint above it). I suggest you double check the database.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.