[code]Segue o que acontece de errado:
1. Parte.
MEU ARQUIVO: HIBERNATE.CFG.XML (ESTA CORRETO)
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="connection.url">jdbc:postgresql://localhost:5432/Cadastro</property>
<property name="connection.username">postgres</property>
<property name="connection.password">admin</property>
<!-- <property name="hibernate.default_schema">cadastro</property> -->
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<!-- Enable Hibernate's current session context -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup
<property name="hbm2ddl.auto">create</property>
<mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
<mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/> -->
</session-factory>
</hibernate-configuration>
[/code]
[code]
2. Parte
QUANDO MANDO EXECUTAR MINHA CLASSE MAIN, APARECE O SEGUINTE ERRO:
270 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
281 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.3.Final
284 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
289 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
296 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
445 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: hibernate.cfg.xml
445 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: hibernate.cfg.xml
534 [main] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
570 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
602 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.PostgreSQLDialect
700 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.hibernate.chapter1.Empregador
788 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity br.com.hibernate.chapter1.Empregador on table Empregador
905 [main] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
920 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - Running hbm2ddl schema export
924 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - exporting generated schema to database
928 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
928 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 2
928 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
952 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/Cadastro
952 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=postgres, password=****}
drop table Empregador cascade
create table Empregador (empId int4 not null, empNome varchar(255), primary key (empId))
1125 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: create table Empregador (empId int4 not null, empNome varchar(255), primary key (empId))
1125 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ERROR: no schema has been selected to create in
1125 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - schema export complete
1128 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:postgresql://localhost:5432/Cadastro
O ERRO É APRESENTADO NA LINHA 1125 EM DIANTE.
OCORRE QUE ESSA TABELA É UMA TABELA DE TESTE, POIS PRECISO MAPEAR DUAS CLASSES E NAO SÃO TÃO CURTAS ASSIM, SE ALGUEM PUDER AJUDAR, AGRADEÇO.
[/code]
[code]
EU JA ESTOU PESQUISANDO COMO FAZ, MAS SE ALGUEM SOUBER, COMO EU FAÇO A COMUNICAÇÃO ENTRE MEU FORMULÁRIO JSP (CRUD), COM OS DADOS DO JPA, TO MEIO PERDIDO NESSA, POIS ENTENDI COMO FUNCIONA O MAPEAMENTO COM ANNOTATIONS, MAS DEPOIS DAS CLASSES MAPEADAS NÃO ENTENDI MUITO BEM COMO FAÇO ESSA INTEGRAÇÃO.
[/code]
[code]Segue o que acontece de errado:
- Parte.
MEU ARQUIVO: HIBERNATE.CFG.XML (ESTA CORRETO)
<?xml version=‘1.0’ encoding=‘utf-8’?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
“http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”>
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="connection.url">jdbc:postgresql://localhost:5432/Cadastro</property>
<property name="connection.username">postgres</property>
<property name="connection.password">admin</property>
<!-- <property name="hibernate.default_schema">cadastro</property> -->
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<!-- Enable Hibernate's current session context -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup
<property name="hbm2ddl.auto">create</property>
<mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
<mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/> -->
</session-factory>
</hibernate-configuration>
[/code]
2. Parte
QUANDO MANDO EXECUTAR MINHA CLASSE MAIN, APARECE O SEGUINTE ERRO:
270 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
281 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.3.Final
284 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
289 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
296 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
445 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: hibernate.cfg.xml
445 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: hibernate.cfg.xml
534 [main] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
570 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
602 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.PostgreSQLDialect
700 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.hibernate.chapter1.Empregador
788 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity br.com.hibernate.chapter1.Empregador on table Empregador
905 [main] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
920 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - Running hbm2ddl schema export
924 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - exporting generated schema to database
928 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
928 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 2
928 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
952 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/Cadastro
952 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=postgres, password=****}
drop table Empregador cascade
create table Empregador (empId int4 not null, empNome varchar(255), primary key (empId))
1125 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: create table Empregador (empId int4 not null, empNome varchar(255), primary key (empId))
1125 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ERROR: no schema has been selected to create in
1125 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - schema export complete
1128 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:postgresql://localhost:5432/Cadastro
O ERRO É APRESENTADO NA LINHA 1125 EM DIANTE.
OCORRE QUE ESSA TABELA É UMA TABELA DE TESTE, POIS PRECISO MAPEAR DUAS CLASSES E NAO SÃO TÃO CURTAS ASSIM, SE ALGUEM PUDER AJUDAR, AGRADEÇO.
EU JA ESTOU PESQUISANDO COMO FAZ, MAS SE ALGUEM SOUBER, COMO EU FAÇO A COMUNICAÇÃO ENTRE MEU FORMULÁRIO JSP (CRUD), COM OS DADOS DO JPA, TO MEIO PERDIDO NESSA, POIS ENTENDI COMO FUNCIONA O MAPEAMENTO COM ANNOTATIONS, MAS DEPOIS DAS CLASSES MAPEADAS NÃO ENTENDI MUITO BEM COMO FAÇO ESSA INTEGRAÇÃO.