hibernare Schema de export se întâmplă de două ori

un prieten și am dezvoltat o aplicație web pentru gestionarea conferințelor care folosește hibernatul (proiect școlar). Când încep aplicația, tabelele db (mysql) sunt create cu unele date. Până de curând totul a funcționat bine, dar ieri, prietenul meu a introdus funcționalitatea pentru a atribui participantului la conferință, și ori de câte ori încerc să îl folosesc, am obținut următoarele lucruri (am eliminat consola chiar înainte de această acțiune):

Hibernate: 
    select
        conference0_.conferenceId as conferen1_2_,
        conference0_.active as active2_,
        conference0_.description as descript3_2_,
        conference0_.endDate as endDate2_,
        conference0_.location_name as location7_2_,
        conference0_.name as name2_,
        conference0_.startDate as startDate2_ 
    from
        test.CONFERENCES conference0_ 
    where
        conference0_.name=?
Hibernate: 
    select
        location0_.name as name5_0_,
        location0_.active as active5_0_,
        location0_.address as address5_0_,
        location0_.contactName as contactN4_5_0_,
        location0_.locationId as locationId5_0_,
        location0_.maxCapacity as maxCapac6_5_0_,
        location0_.phone1 as phone7_5_0_,
        location0_.phone2 as phone8_5_0_ 
    from
        test.LOCATION location0_ 
    where
        location0_.name=?
Hibernate: 
    select
        user0_.userId as userId1_,
        user0_.active as active1_,
        user0_.admin as admin1_,
        user0_.company_companyID as company13_1_,
        user0_.email as email1_,
        user0_.lastLogin as lastLogin1_,
        user0_.name as name1_,
        user0_.pasportID as pasportID1_,
        user0_.password as password1_,
        user0_.phone1 as phone9_1_,
        user0_.phone2 as phone10_1_,
        user0_.salt as salt1_,
        user0_.userName as userName1_ 
    from
        test.Users user0_ 
    where
        user0_.userName=?
Hibernate: 
    select
        company0_.companyID as companyID0_0_,
        company0_.active as active0_0_,
        company0_.companyType as companyT3_0_0_,
        company0_.name as name0_0_ 
    from
        test.Company company0_ 
    where
        company0_.companyID=?
Hibernate: 
    alter table test.CONFERENCES 
        drop 
        foreign key FKC0DCF2B7133695CF
04/06/2012 22:42:32 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000227: Running hbm2ddl schema export
Hibernate: 
    alter table test.Conferences_Participants 
        drop 
        foreign key FK5D9C90484DAAAE9B
Hibernate: 
    alter table test.Conferences_Participants 
        drop 
        foreign key FK5D9C9048751CA8AA
Hibernate: 
    alter table test.Conferences_Users 
        drop 
        foreign key FK7EAAE2604DAAAE9B
Hibernate: 
    alter table test.Conferences_Users 
        drop 
        foreign key FK7EAAE260751CA8AA
Hibernate: 
    alter table test.Users 
        drop 
        foreign key FK4E39DE8B5D743AE
Hibernate: 
    drop table if exists test.CONFERENCES
Hibernate: 
    drop table if exists test.Company
Hibernate: 
    drop table if exists test.Conferences_Participants
Hibernate: 
    drop table if exists test.Conferences_Users
04/06/2012 22:42:33 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000230: Schema export complete
04/06/2012 22:42:33 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
04/06/2012 22:42:33 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
04/06/2012 22:42:33 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
04/06/2012 22:42:33 org.hibernate.mapping.RootClass checkCompositeIdentifier
WARN: HHH000038: Composite-id class does not override equals(): model.ConferencesParticipants
04/06/2012 22:42:33 org.hibernate.mapping.RootClass checkCompositeIdentifier
WARN: HHH000039: Composite-id class does not override hashCode(): model.ConferencesParticipants
04/06/2012 22:42:33 org.hibernate.mapping.RootClass checkCompositeIdentifier
WARN: HHH000038: Composite-id class does not override equals(): model.ConferencesUsers
04/06/2012 22:42:33 org.hibernate.mapping.RootClass checkCompositeIdentifier
WARN: HHH000039: Composite-id class does not override hashCode(): model.ConferencesUsers
04/06/2012 22:42:33 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
04/06/2012 22:42:33 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 1
04/06/2012 22:42:33 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
04/06/2012 22:42:33 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/test]
04/06/2012 22:42:33 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
Hibernate: 
    drop table if exists test.LOCATION
Hibernate: 
    drop table if exists test.Users
04/06/2012 22:42:34 org.hibernate.dialect.Dialect 
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
04/06/2012 22:42:34 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
04/06/2012 22:42:34 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory 
INFO: HHH000397: Using ASTQueryTranslatorFactory
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000227: Running hbm2ddl schema export
Hibernate: 
    alter table test.CONFERENCES 
        drop 
        foreign key FKC0DCF2B7133695CF
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: HHH000389: Unsuccessful: alter table test.CONFERENCES drop foreign key FKC0DCF2B7133695CF
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: Table 'test.conferences' doesn't exist
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: HHH000389: Unsuccessful: alter table test.Conferences_Participants drop foreign key FK5D9C90484DAAAE9B
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: Table 'test.conferences_participants' doesn't exist
Hibernate: 
    alter table test.Conferences_Participants 
        drop 
        foreign key FK5D9C90484DAAAE9B
Hibernate: 
    alter table test.Conferences_Participants 
        drop 
        foreign key FK5D9C9048751CA8AA
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: HHH000389: Unsuccessful: alter table test.Conferences_Participants drop foreign key FK5D9C9048751CA8AA
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: Table 'test.conferences_participants' doesn't exist
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: HHH000389: Unsuccessful: alter table test.Conferences_Users drop foreign key FK7EAAE2604DAAAE9B
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: Table 'test.conferences_users' doesn't exist
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: HHH000389: Unsuccessful: alter table test.Conferences_Users drop foreign key FK7EAAE260751CA8AA
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: Table 'test.conferences_users' doesn't exist
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: HHH000389: Unsuccessful: alter table test.Users drop foreign key FK4E39DE8B5D743AE
04/06/2012 22:42:34 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: Table 'test.users' doesn't exist
Hibernate: 
    alter table test.Conferences_Users 
        drop 
        foreign key FK7EAAE2604DAAAE9B
Hibernate: 
    alter table test.Conferences_Users 
        drop 
        foreign key FK7EAAE260751CA8AA
Hibernate: 
    alter table test.Users 
        drop 
        foreign key FK4E39DE8B5D743AE
Hibernate: 
    drop table if exists test.CONFERENCES
Hibernate: 
    drop table if exists test.Company
Hibernate: 
    drop table if exists test.Conferences_Participants
Hibernate: 
    drop table if exists test.Conferences_Users
Hibernate: 
    drop table if exists test.LOCATION
Hibernate: 
    drop table if exists test.Users
Hibernate: 
    create table test.CONFERENCES (
        conferenceId bigint not null,
        active boolean not null,
        description varchar(255),
        endDate datetime,
        name varchar(255),
        startDate datetime,
        location_name varchar(255),
        primary key (conferenceId)
    )
Hibernate: 
    create table test.Company (
        companyID bigint not null,
        active boolean not null,
        companyType varchar(255),
        name varchar(255),
        primary key (companyID)
    )
Hibernate: 
    create table test.Conferences_Participants (
        date datetime not null,
        user_userId bigint not null,
        conference_conferenceId bigint not null,
        primary key (user_userId, date, conference_conferenceId),
        unique (user_userId),
        unique (conference_conferenceId)
    )
Hibernate: 
    create table test.Conferences_Users (
        attendanceStatus integer,
        notifiedByMail boolean not null,
        userRole integer not null,
        user_userId bigint not null,
        conference_conferenceId bigint not null,
        primary key (user_userId, conference_conferenceId),
        unique (user_userId),
        unique (conference_conferenceId)
    )
Hibernate: 
    create table test.LOCATION (
        name varchar(255) not null,
        active boolean not null,
        address varchar(255),
        contactName varchar(255),
        locationId bigint not null,
        maxCapacity integer not null,
        phone1 varchar(255),
        phone2 varchar(255),
        primary key (name)
    )
Hibernate: 
    create table test.Users (
        userId bigint not null,
        active boolean not null,
        admin boolean not null,
        email varchar(255),
        lastLogin datetime,
        name varchar(255),
        pasportID varchar(255),
        password varchar(255),
        phone1 varchar(255),
        phone2 varchar(255),
        salt varchar(255),
        userName varchar(255),
        company_companyID bigint,
        primary key (userId)
    )
Hibernate: 
    alter table test.CONFERENCES 
        add index FKC0DCF2B7133695CF (location_name), 
        add constraint FKC0DCF2B7133695CF 
        foreign key (location_name) 
        references test.LOCATION (name)
Hibernate: 
    alter table test.Conferences_Participants 
        add index FK5D9C90484DAAAE9B (conference_conferenceId), 
        add constraint FK5D9C90484DAAAE9B 
        foreign key (conference_conferenceId) 
        references test.CONFERENCES (conferenceId)
Hibernate: 
    alter table test.Conferences_Participants 
        add index FK5D9C9048751CA8AA (user_userId), 
        add constraint FK5D9C9048751CA8AA 
        foreign key (user_userId) 
        references test.Users (userId)
Hibernate: 
    alter table test.Conferences_Users 
        add index FK7EAAE2604DAAAE9B (conference_conferenceId), 
        add constraint FK7EAAE2604DAAAE9B 
        foreign key (conference_conferenceId) 
        references test.CONFERENCES (conferenceId)
Hibernate: 
    alter table test.Conferences_Users 
        add index FK7EAAE260751CA8AA (user_userId), 
        add constraint FK7EAAE260751CA8AA 
        foreign key (user_userId) 
        references test.Users (userId)
Hibernate: 
    alter table test.Users 
        add index FK4E39DE8B5D743AE (company_companyID), 
        add constraint FK4E39DE8B5D743AE 
        foreign key
0

2 răspunsuri

Realizați problema în timpul hibernării. dintr-un motiv, indiferent de ce am încercat în Eclipse, codul nu era în sincronizare cu codul compilat. Am rezolvat problema creând un nou spațiu de lucru.

0
adăugat

În jurnalele dvs. văd că există o valoare nulă:

04/06/2012 22:42:36 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 1048, SQLState: 23000
04/06/2012 22:42:36 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Column 'user_userId' cannot be null

Btw, care sisteme de operare pe care tu și prietenul tău le folosești? O întreb pentru că investighez o problemă similară.

0
adăugat