Estou tentando executar uma aplicação simples, que por enquanto só tem três classes e acontece o seguinte erro:
run:
03/09/2011 16:19:53 org.hibernate.cfg.annotations.Version
INFO: Hibernate Annotations 3.3.1.GA
03/09/2011 16:19:53 org.hibernate.cfg.Environment
INFO: Hibernate 3.2.5
03/09/2011 16:19:53 org.hibernate.cfg.Environment
INFO: hibernate.properties not found
03/09/2011 16:19:53 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
03/09/2011 16:19:53 org.hibernate.cfg.Environment
INFO: using JDK 1.4 java.sql.Timestamp handling
03/09/2011 16:19:53 org.hibernate.ejb.Version
INFO: Hibernate EntityManager 3.3.2.GA
03/09/2011 16:19:54 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: entidades.Cidade
03/09/2011 16:19:54 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity entidades.Cidade on table Cidade
03/09/2011 16:19:54 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: entidades.Usuario
03/09/2011 16:19:54 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity entidades.Usuario on table Usuario
[PersistenceUnit: FrigoManagerPU] Unable to configure EntityManagerFactory
Exception in thread “main” java.lang.NullPointerException
at execucao.Main.main(Main.java:24)
É a primeira vez que tento fazer com o SQLServer 2008.
Persistence
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="FrigoManagerPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>entidades.Cadastros</class>
<class>entidades.Cidade</class>
<class>entidades.Usuario</class>
<properties>
<property name="hibernate.connection.username" value="DBATAK"/>
<property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="hibernate.connection.password" value="1"/>
<property name="hibernate.connection.url" value="jdbc:sqlserver://;databaseName=SATKBTA"/>
</properties>
</persistence-unit>
</persistence>
Na classe Dao
propConexao = new HashMap();
propConexao.put("hibernate.connection.driver_class","com.microsoft.sqlserver.jdbc.SQLServerDriver");
propConexao.put("hibernate.connection.url","jdbc:sqlserver://;databaseName=SATKBTA");
propConexao.put("hibernate.connection.username", "dbatak");
propConexao.put("hibernate.connection.password", "1");
Obrigado!