1

Trying to connect, using Hibernate 4.3, to SQL Server with Windows Authentication, i'm getting a:

"No Persistence provider for EntityManager named instanceTest"

I have loaded the sqljdbc_auth.dll library and im using this url:

jdbc:sqlserver://localhost:1433;databaseName=WIN_AUTHDB;integratedSecurity=true

The parameters which i am using to create the entity manager factory are:

properties.put("background-validation", "true");
properties.put("hibernate.c3p0.idle_test_period", "3600");
properties.put("hibernate.hbm2ddl.auto", "update");
properties.put("hibernate.max_fetch_depth", "3");
properties.put("hibernate.connection.driver_class", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
properties.put("hibernate.connection.url","jdbc:sqlserver://localhost:1433;databaseName=WIN_AUTHDB;integratedSecurity=true");

Im missing something? Maybe is the dll not loaded? The error is thrown at this line:

Persistence.createEntityManagerFactory("instanceTest", initProperties(properties));

The database is correctly configured, i have connected through Windows Authentication with the SQL Server Management. Also, in a previous test, i achieved to create a database using the driver without hibernate.

Thanks in advance.

Jose__vi
  • 158
  • 2
  • 10

2 Answers2

0

Along those, add the below property

properties.put("hibernate.dialect", "org.hibernate.dialect.SQLServerDialect");
CallumDA
  • 12,025
  • 6
  • 30
  • 52
0

Resolved!

Much more simple than I thought. When I was compiling the maven project, i was unintentionally deleting the persistence.xml file. Thats the reason because it never found the persistence provider at the war.

Jose__vi
  • 158
  • 2
  • 10