Generating tables in sql-server with Hibernate

Asked

Viewed 445 times

1

I am migrating a Java system to work with 2 or more databases. I created the tables for Firebird using Hibernate without many problems. The second database was not successful. SQL-Server. Because microsoft products have to be different ?

Well... my persistence.xml properties

 <property name="hibernate.connection.username" value="touchcomp"/>
        <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
        <property name="hibernate.connection.password" value="touch"/>
        <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost:1433/mentor?lc_ctype=ISO8859_1"/>
        <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
        <property name="hibernate.hbm2ddl.auto" value="update"/>
        <property name="hibernate.ejb.cfgfile" value="hibernate.mentor.xml"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialec"/>
    </properties>

My local.xml file

    <?xml version="1.0" encoding="UTF-8"?>
<mentorLocal>
    <url.database>jdbc:sqlserver://host:porta;databaseName=mentor</url.database>
    <host>localhost</host>
    <porta>1433</porta>
    <url.database.cep>jdbc:sqlserver://host:porta/endereco</url.database.cep>
    <url.database.log>jdbc:sqlserver://host:porta/log</url.database.log>
    <url.database.nfe>jdbc:sqlserver://host:porta/nfe</url.database.nfe>
    <generationStrategy>update</generationStrategy>
    <versao.codigo>20030</versao.codigo>
    <versao.sub.codigo>23</versao.sub.codigo>
<url.database.communicator>jdbc:sqlserver://host:porta/communicator</url.database.communicator>

In our system there is still a file called Hibernate.mentor.xml, where there is this code snippet.

<hibernate-configuration>
<session-factory>
    <property name="dialect">org.hibernate.dialect.SQLServerDialec</property>
    <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
    <property name="show_sql">true</property>
    <property name="use_outer_join">false</property>
    <property name="format_sql">false</property>
    <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
    <property name="jilo">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
    <property name="connection.username">touchcomp</property>
    <property name="hibernate.connection.username">touchcomp</property>
    <property name="connection.password">touch</property>
    <property name="hibernate.connection.password">touch</property>
    <property name="hibernate.current_session_context_class">thread</property>

When the application is executed, it seems that Hibernate tries to create the tables but does not succeed. Follow the logs.

compile:
run:
13:01:11,441 ERROR [SchemaUpdate] HHH000388: Unsuccessful: create table  ENVIAR_EMAIL (ID_ENVIAR_EMAIL numeric(19,0) identity not null, DATA_ATUALIZACAO datetime,  DATA_CADASTRO  datetime,  DESCRICAO  varchar(255),  MODELO  varchar(255), TITULO_EMAIL varchar(255),  ID_EMPRESA  numeric(19,0), primary key (ID_ENVIAR_EMAIL))
13:01:11,442 ERROR [SchemaUpdate] There is already an object named 'ENVIAR_EMAIL' in the database.
13:01:11,443 ERROR [SchemaUpdate] HHH000388: Unsuccessful: create table  VALOR_FIC_TEC_OS_linha_prod (ID_VR_FIC_TEC_OS_linha_prod numeric(19,0) identity not null, CHAVE varchar(80), VALOR varchar(255), valor_obrigatorio smallint, ID_FIC_TEC_OS_LINHA_PROD numeric(19,0), primary key (ID_VR_FIC_TEC_OS_linha_prod))
13:01:11,444 ERROR [SchemaUpdate] There is already an object named 'VALOR_FIC_TEC_OS_linha_prod' in the database.
13:01:11,445 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table CTE add PESO_TOTAL_NFES  double precision
13:01:11,445 ERROR [SchemaUpdate] Column names in each table must be unique. Column name 'PESO_TOTAL_NFES' in table 'CTE' is specified more than once.
13:01:11,447 ERROR [SchemaUpdate] HHH000388: Unsuccessful: create table OPCOES_CONT_FISCAL  (ID_OPCOES_CONT_FISCAL numeric(19,0) identity not null, DATA_ATUALIZACAO datetime, ID_GRUPO_EMPRESA numeric(19,0), primary key (ID_OPCOES_CONT_FISCAL))
13:01:11,447 ERROR [SchemaUpdate] There is already an object named 'OPCOES_CONT_FISCAL' in the database.
13:01:11,448 ERROR [SchemaUpdate] HHH000388: Unsuccessful: create table OPCOES_CONT_GNRE  (ID_OPCOES_CONT_GNRE numeric(19,0) identity not null, CONTABILIZAR int, ID_OPCOES_CONT_FISCAL numeric(19,0) not null, primary key (ID_OPCOES_CONT_GNRE))
13:01:11,448 ERROR [SchemaUpdate] There is already an object named 'OPCOES_CONT_GNRE' in the database.
13:01:11,449 ERROR [SchemaUpdate] HHH000388: Unsuccessful: create table OPCOES_CONT_GNRE_UF  (ID_OPCOES_CONT_GNRE_UF numeric(19,0) identity not null, ID_OPCOES_CONT_GNRE numeric(19,0), ID_PLANO_CONTA numeric(19,0), ID_UF numeric(19,0), primary key (ID_OPCOES_CONT_GNRE_UF))
13:01:11,449 ERROR [SchemaUpdate] There is already an object named 'OPCOES_CONT_GNRE_UF' in the database.
13:01:11,450 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table PERIODO_AQ_FERIAS_COLAB add     ID_COLABORADOR numeric(19,0)
13:01:11,450 ERROR [SchemaUpdate] Column names in each table must be unique. Column name 'ID_COLABORADOR' in table 'PERIODO_AQ_FERIAS_COLAB' is specified more than once.
13:01:11,451 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table RECISAO add NR_RECISO_RECISAO  int
13:01:11,451 ERROR [SchemaUpdate] Column names in each table must be unique. Column name 'NR_RECISO_RECISAO' in table 'RECISAO' is specified more than once.
13:01:11,452 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table  ENVIAR_EMAIL add constraint FK_o6ddbfugogw2kw6xm51gfgejk foreign key ( ID_EMPRESA ) references empresa
13:01:11,452 ERROR [SchemaUpdate] There is already an object named 'FK_o6ddbfugogw2kw6xm51gfgejk' in the database.
13:01:11,453 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table  VALOR_FIC_TEC_OS_linha_prod add constraint FK_d5h6orp767hudqe565qtdbdaq foreign key (ID_FIC_TEC_OS_LINHA_PROD) references FICHA_TEC_OS_PROD_linha_prod
13:01:11,453 ERROR [SchemaUpdate] There is already an object named 'FK_d5h6orp767hudqe565qtdbdaq' in the database.
13:01:11,453 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table CLIENTE_CONVENIO_CP add constraint FK_saujos4icpcxiue84m2yu0euh foreign key (ID_CLIENTE_CUPOM) references OUTRO_DEVEDOR
13:01:11,453 ERROR [SchemaUpdate] There is already an object named 'FK_saujos4icpcxiue84m2yu0euh' in the database.
13:01:11,454 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table CLIENTE_CONVENIO_CP add constraint FK_tmjc47bxcpnp30tr9hbfaghog foreign key (ID_CONVENIO_CUPOM) references convenio_cliente_cupom
13:01:11,454 ERROR [SchemaUpdate] There is already an object named 'FK_tmjc47bxcpnp30tr9hbfaghog' in the database.
13:01:11,455 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table OPCOES_CONT_FISCAL  add constraint FK_2qyc6r9u6ejkf7k44cbxn3w0v foreign key (ID_GRUPO_EMPRESA) references GRUPO_EMPRESA
13:01:11,455 ERROR [SchemaUpdate] There is already an object named 'FK_2qyc6r9u6ejkf7k44cbxn3w0v' in the database.
13:01:11,456 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table OPCOES_CONT_GNRE  add constraint FK_7hwy1q0ebhlfdkoirq0vplvff foreign key (ID_OPCOES_CONT_FISCAL) references OPCOES_CONT_FISCAL 
13:01:11,456 ERROR [SchemaUpdate] There is already an object named 'FK_7hwy1q0ebhlfdkoirq0vplvff' in the database.
13:01:11,456 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table OPCOES_CONT_GNRE_UF  add constraint FK_gelbxxgvu2w2ms8515tbrs8sn foreign key (ID_OPCOES_CONT_GNRE) references OPCOES_CONT_GNRE 
13:01:11,456 ERROR [SchemaUpdate] There is already an object named 'FK_gelbxxgvu2w2ms8515tbrs8sn' in the database.
13:01:11,457 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table OPCOES_CONT_GNRE_UF  add constraint FK_kj6t0l4672j2814n0la0b6c3l foreign key (ID_PLANO_CONTA) references plano_conta
13:01:11,457 ERROR [SchemaUpdate] There is already an object named 'FK_kj6t0l4672j2814n0la0b6c3l' in the database.
13:01:11,458 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table OPCOES_CONT_GNRE_UF  add constraint FK_4wbbvkssvf9981oki6on9rvfi foreign key (ID_UF) references uf
13:01:11,458 ERROR [SchemaUpdate] There is already an object named 'FK_4wbbvkssvf9981oki6on9rvfi' in the database.
13:01:11,458 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table PERIODO_AQ_FERIAS_COLAB add constraint FK_o72vkmiobehojsidiria0unrk foreign key (    ID_COLABORADOR) references COLABORADOR
13:01:11,458 ERROR [SchemaUpdate] There is already an object named 'FK_o72vkmiobehojsidiria0unrk' in the database.
13:01:11,459 ERROR [SchemaUpdate] HHH000388: Unsuccessful: alter table tokens_obs_int_fisco add constraint FK_j1pi1xggfsyjcw7or2qy8h2eh foreign key (id_obs_int_fisco) references OBSERVACAO_INT_FISCAL_NF_PR
13:01:11,459 ERROR [SchemaUpdate] There is already an object named 'FK_j1pi1xggfsyjcw7or2qy8h2eh' in the database.
Hibernate: select empresa0_.ID_EMP as ID_EMP1_840_, empresa0_.aliquota_icms_simples as aliquota2_840_, empresa0_.ativo as ativo3_840_, empresa0_.id_cnae as id_cnae18_840_, empresa0_.DATA_ATUALIZACAO as DATA_ATU4_840_, empresa0_.data_cadastro as data_cad5_840_, empresa0_.id_grupo_empresa as id_grup19_840_, empresa0_.incentivador_cultural as incentiv6_840_, empresa0_.indicador_apuracao_ipi as indicado7_840_, empresa0_.id_indicador_atividade as id_indi20_840_, empresa0_.INSC_ANTT as INSC_ANT8_840_, empresa0_.INSC_BANCO_CENTRAL as INSC_BAN9_840_, empresa0_.INSC_CVM as INSC_CV10_840_, empresa0_.INSC_JUNTA_COMERCIAL as INSC_JU11_840_, empresa0_.INSC_SUSEP as INSC_SU12_840_, empresa0_.lancar_cto_custo_entrada as lancar_13_840_, empresa0_.logo_boleto as logo_bo14_840_, empresa0_.logo_relatorios as logo_re15_840_, empresa0_.MATRIZ as MATRIZ16_840_, empresa0_.ID_PERFIL_SPED_FISCAL as ID_PERF21_840_, empresa0_.permitir_estoque_negativo as permiti17_840_, empresa0_.ID_PESSOA as ID_PESS22_840_, empresa0_.id_proxy_email as id_prox23_840_, empresa0_.id_proxy_http as id_prox24_840_, empresa0_.id_regime_tributario as id_regi25_840_, empresa0_.TIPO_EMPRESA as TIPO_EM26_840_ from empresa empresa0_ cross join PESSOA pessoa1_ where empresa0_.ID_PESSOA=pessoa1_.ID_PESSOA and empresa0_.ativo=? and pessoa1_.ativo=? order by empresa0_.MATRIZ desc, pessoa1_.NOME asc
Hibernate: select this_.ID_config_log_usuarios as ID_confi1_775_15_, this_.data_atualizacao as data_atu2_775_15_, this_.id_empresa as id_empre6_775_15_, this_.gerar_log_delete as gerar_lo3_775_15_, this_.gerar_log_editar as gerar_lo4_775_15_, this_.gerar_log_insert as gerar_lo5_775_15_, conflogcla2_.id_conf_log_usuarios as id_conf_4_775_17_, conflogcla2_.ID_config_log_usuarios_clas as ID_confi1_776_17_, conflogcla2_.ID_config_log_usuarios_clas as ID_confi1_776_0_, conflogcla2_.classe as classe2_776_0_, conflogcla2_.id_conf_log_usuarios as id_conf_4_776_0_, conflogcla2_.descricao as descrica3_776_0_, empresa3_.ID_EMP as ID_EMP1_840_1_, empresa3_.aliquota_icms_simples as aliquota2_840_1_, empresa3_.ativo as ativo3_840_1_, empresa3_.id_cnae as id_cnae18_840_1_, empresa3_.DATA_ATUALIZACAO as DATA_ATU4_840_1_, empresa3_.data_cadastro as data_cad5_840_1_, empresa3_.id_grupo_empresa as id_grup19_840_1_, empresa3_.incentivador_cultural as incentiv6_840_1_, empresa3_.indicador_apuracao_ipi as indicado7_840_1_, empresa3_.id_indicador_atividade as id_indi20_840_1_, empresa3_.INSC_ANTT as INSC_ANT8_840_1_, empresa3_.INSC_BANCO_CENTRAL as INSC_BAN9_840_1_, empresa3_.INSC_CVM as INSC_CV10_840_1_, empresa3_.INSC_JUNTA_COMERCIAL as INSC_JU11_840_1_, empresa3_.INSC_SUSEP as INSC_SU12_840_1_, empresa3_.lancar_cto_custo_entrada as lancar_13_840_1_, empresa3_.logo_boleto as logo_bo14_840_1_, empresa3_.logo_relatorios as logo_re15_840_1_, empresa3_.MATRIZ as MATRIZ16_840_1_, empresa3_.ID_PERFIL_SPED_FISCAL as ID_PERF21_840_1_, empresa3_.permitir_estoque_negativo as permiti17_840_1_, empresa3_.ID_PESSOA as ID_PESS22_840_1_, empresa3_.id_proxy_email as id_prox23_840_1_, empresa3_.id_proxy_http as id_prox24_840_1_, empresa3_.id_regime_tributario as id_regi25_840_1_, empresa3_.TIPO_EMPRESA as TIPO_EM26_840_1_, cnae4_.ID_cnae as ID_cnae1_756_2_, cnae4_.codigo as codigo2_756_2_, cnae4_.descricao as descrica3_756_2_, perfilsped5_.ID_PERFIL_SPED_FISCAL as ID_PERFI1_517_3_, perfilsped5_.CODIGO as CODIGO2_517_3_, perfilsped5_.DESCRICAO as DESCRICA3_517_3_, pessoa6_.ID_PESSOA as ID_PESSO1_524_4_, pessoa6_.ativo as ativo2_524_4_, pessoa6_.id_complemento as id_compl9_524_4_, pessoa6_.data_atualizacao as data_atu3_524_4_, pessoa6_.DATA_CADASTRO as DATA_CAD4_524_4_, pessoa6_.DATA_INICIO_RELACIONAMENTO as DATA_INI5_524_4_, pessoa6_.ID_ENDERECO as ID_ENDE10_524_4_, pessoa6_.id_grupo_pessoas as id_grup11_524_4_, pessoa6_.NOME as NOME6_524_4_, pessoa6_.NOME_FANTASIA as NOME_FAN7_524_4_, pessoa6_.PESSOA_CONTATO as PESSOA_C8_524_4_, complement7_.id_complemento as id_compl1_99_5_, complement7_.ativo as ativo2_99_5_, complement7_.cel1 as cel3_99_5_, complement7_.cel2 as cel4_99_5_, complement7_.cnpj as cnpj5_99_5_, complement7_.CODIGO_IMA as CODIGO_I6_99_5_, complement7_.data_atualizacao as data_atu7_99_5_, complement7_.DATA_EMISSAO_RG as DATA_EMI8_99_5_, complement7_.data_nascimento as data_nas9_99_5_, complement7_.DATA_VALIDADE_IMA as DATA_VA10_99_5_, complement7_.fax1 as fax11_99_5_, complement7_.fax2 as fax12_99_5_, complement7_.fone1 as fone13_99_5_, complement7_.fone2 as fone14_99_5_, complement7_.habilitar_suframa as habilit15_99_5_, complement7_.inscricao_estadual as inscric16_99_5_, complement7_.inscricao_estadual_ST as inscric17_99_5_, complement7_.inscricao_municipal as inscric18_99_5_, complement7_.nit as nit19_99_5_, complement7_.orgao_emissor as orgao_e20_99_5_, complement7_.rg as rg21_99_5_, complement7_.site as site22_99_5_, complement7_.suframa as suframa23_99_5_, endereco8_.ID_ENDERECO as ID_ENDER1_844_6_, endereco8_.BAIRRO as BAIRRO2_844_6_, endereco8_.CEP as CEP3_844_6_, endereco8_.id_cidade as id_cidad7_844_6_, endereco8_.COMPLEMENTO as COMPLEME4_844_6_, endereco8_.LOGRADOURO as LOGRADOU5_844_6_, endereco8_.NUMERO as NUMERO6_844_6_, cidade9_.ID_CIDADE as ID_CIDAD1_85_7_, cidade9_.cep as cep2_85_7_, cidade9_.cod_ibge as cod_ibge3_85_7_, cidade9_.data_atualizacao as data_atu4_85_7_, cidade9_.DATA_CADASTRO as DATA_CAD5_85_7_, cidade9_.descricao as descrica6_85_7_, cidade9_.ID_UF as ID_UF7_85_7_, unidadefed10_.id_uf as id_uf1_1193_8_, unidadefed10_.cod_ibge as cod_ibge2_1193_8_, unidadefed10_.data_atualizacao as data_atu3_1193_8_, unidadefed10_.data_cadastro as data_cad4_1193_8_, unidadefed10_.descricao as descrica5_1193_8_, unidadefed10_.inscricao_estadual as inscrica6_1193_8_, unidadefed10_.inscrito_estado as inscrito7_1193_8_, unidadefed10_.ID_PAIS as ID_PAIS9_1193_8_, unidadefed10_.sigla as sigla8_1193_8_, pais11_.ID_PAIS as ID_PAIS1_508_9_, pais11_.cod_pais as cod_pais2_508_9_, pais11_.data_atualizacao as data_atu3_508_9_, pais11_.DATA_CADASTRO as DATA_CAD4_508_9_, pais11_.descricao as descrica5_508_9_, grupopesso12_.ID_GRUPO_PESSOA as ID_GRUPO1_263_10_, grupopesso12_.data_atualizacao as data_atu2_263_10_, grupopesso12_.data_cadastro as data_cad3_263_10_, grupopesso12_.id_empresa as id_empre5_263_10_, grupopesso12_.nome_grupo as nome_gru4_263_10_, empresa13_.ID_EMP as ID_EMP1_840_11_, empresa13_.aliquota_icms_simples as aliquota2_840_11_, empresa13_.ativo as ativo3_840_11_, empresa13_.id_cnae as id_cnae18_840_11_, empresa13_.DATA_ATUALIZACAO as DATA_ATU4_840_11_, empresa13_.data_cadastro as data_cad5_840_11_, empresa13_.id_grupo_empresa as id_grup19_840_11_, empresa13_.incentivador_cultural as incentiv6_840_11_, empresa13_.indicador_apuracao_ipi as indicado7_840_11_, empresa13_.id_indicador_atividade as id_indi20_840_11_, empresa13_.INSC_ANTT as INSC_ANT8_840_11_, empresa13_.INSC_BANCO_CENTRAL as INSC_BAN9_840_11_, empresa13_.INSC_CVM as INSC_CV10_840_11_, empresa13_.INSC_JUNTA_COMERCIAL as INSC_JU11_840_11_, empresa13_.INSC_SUSEP as INSC_SU12_840_11_, empresa13_.lancar_cto_custo_entrada as lancar_13_840_11_, empresa13_.logo_boleto as logo_bo14_840_11_, empresa13_.logo_relatorios as logo_re15_840_11_, empresa13_.MATRIZ as MATRIZ16_840_11_, empresa13_.ID_PERFIL_SPED_FISCAL as ID_PERF21_840_11_, empresa13_.permitir_estoque_negativo as permiti17_840_11_, empresa13_.ID_PESSOA as ID_PESS22_840_11_, empresa13_.id_proxy_email as id_prox23_840_11_, empresa13_.id_proxy_http as id_prox24_840_11_, empresa13_.id_regime_tributario as id_regi25_840_11_, empresa13_.TIPO_EMPRESA as TIPO_EM26_840_11_, proxy14_.ID_PROXY as ID_PROXY1_558_12_, proxy14_.HOST as HOST2_558_12_, proxy14_.PORT as PORT3_558_12_, proxy14_.REQUER_AUTENTICACAO as REQUER_A4_558_12_, proxy14_.SENHA as SENHA5_558_12_, proxy14_.TIPO_PROXY as TIPO_PRO6_558_12_, proxy14_.USUARIO as USUARIO7_558_12_, proxy15_.ID_PROXY as ID_PROXY1_558_13_, proxy15_.HOST as HOST2_558_13_, proxy15_.PORT as PORT3_558_13_, proxy15_.REQUER_AUTENTICACAO as REQUER_A4_558_13_, proxy15_.SENHA as SENHA5_558_13_, proxy15_.TIPO_PROXY as TIPO_PRO6_558_13_, proxy15_.USUARIO as USUARIO7_558_13_, regimetrib16_.ID_REGIME_TRIBUTARIO as ID_REGIM1_1109_14_, regimetrib16_.CODIGO as CODIGO2_1109_14_, regimetrib16_.descricao as descrica3_1109_14_ from config_log_usuarios this_ left outer join config_log_usuarios_clas conflogcla2_ on this_.ID_config_log_usuarios=conflogcla2_.id_conf_log_usuarios left outer join empresa empresa3_ on this_.id_empresa=empresa3_.ID_EMP left outer join cnae cnae4_ on empresa3_.id_cnae=cnae4_.ID_cnae left outer join PERFIL_SPED_FISCAL perfilsped5_ on empresa3_.ID_PERFIL_SPED_FISCAL=perfilsped5_.ID_PERFIL_SPED_FISCAL left outer join PESSOA pessoa6_ on empresa3_.ID_PESSOA=pessoa6_.ID_PESSOA left outer join COMPLEMENTO complement7_ on pessoa6_.id_complemento=complement7_.id_complemento left outer join endereco endereco8_ on pessoa6_.ID_ENDERECO=endereco8_.ID_ENDERECO left outer join CIDADE cidade9_ on endereco8_.id_cidade=cidade9_.ID_CIDADE left outer join uf unidadefed10_ on cidade9_.ID_UF=unidadefed10_.id_uf left outer join PAIS pais11_ on unidadefed10_.ID_PAIS=pais11_.ID_PAIS left outer join GRUPO_pessoas grupopesso12_ on pessoa6_.id_grupo_pessoas=grupopesso12_.ID_GRUPO_PESSOA left outer join empresa empresa13_ on grupopesso12_.id_empresa=empresa13_.ID_EMP left outer join PROXY proxy14_ on empresa13_.id_proxy_email=proxy14_.ID_PROXY left outer join PROXY proxy15_ on empresa13_.id_proxy_http=proxy15_.ID_PROXY left outer join regime_tributario regimetrib16_ on empresa13_.id_regime_tributario=regimetrib16_.ID_REGIME_TRIBUTARIO where this_.id_empresa=?
0
  • The message it provides is that the tables are already created.

1 answer

1

Put in place of this setting:

<property name="hibernate.connection.username" value="touchcomp"/>
        <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
        <property name="hibernate.connection.password" value="touch"/>
        <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost:1433/mentor?lc_ctype=ISO8859_1"/>
        <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
        <property name="hibernate.hbm2ddl.auto" value="update"/>
        <property name="hibernate.ejb.cfgfile" value="hibernate.mentor.xml"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialec"/>
</properties>

That one:

<property name="hibernate.connection.username" value="touchcomp"/>
        <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
        <property name="hibernate.connection.password" value="touch"/>
        <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost:1433/mentor?lc_ctype=ISO8859_1"/>
        <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
        <property name="hibernate.hbm2ddl.auto" value="validate"/>
        <property name="hibernate.ejb.cfgfile" value="hibernate.mentor.xml"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialec"/>

Changeover:

<property name="hibernate.hbm2ddl.auto" value="validate"/>

Explanation

Possible actions:

  • validate: validate the scheme, make no changes to the database dice.
  • update: update the schema.
  • create: creates the scheme by destroying previous data.
  • create-drop: remove schema at end of session.

Reference:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.