Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalContainerEntityManagerFactoryBean ignores standard JPA 2.0 properties [SPR-9201] #13839

Closed
spring-projects-issues opened this issue Mar 5, 2012 · 2 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) status: invalid An issue that we don't feel is valid

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 5, 2012

Ronak Patel opened SPR-9201 and commented

Spring's LocalContainerEntityManagerFactoryBean seems to ignore standard JPA 2.0 properties to specify database connection attributes.

This is also highlighted in this stackoverflow link:

http://stackoverflow.com/questions/2660485/why-does-hibernate-ignore-the-jpa2-standardized-properties-in-my-persistence-xml


Affects: 3.0.7

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 5, 2012

Ronak Patel commented

Here is my sample persistence.xml file:

<?xml version="1.0" encoding="UTF-8"?>

<persistence version="2.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_2_0.xsd">

<!--  HSQL -->
<persistence-unit name="snocell-test" transaction-type="RESOURCE_LOCAL">
	<provider>org.hibernate.ejb.HibernatePersistence</provider>

	<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>

	<properties>
		<!-- Derby Properties -->
		<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
		<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:file:target/testdatabase;create=true"/>
		<property name="javax.persistence.jdbc.user" value="sa"/>
		<property name="javax.persistence.jdbc.password" value=""/>

		<property name="hibernate.dialect" value="com.snocell.hibernate.dialect.HSQLGeospatialDialect"/>
		<property name="hibernate.cache.use_query_cache" value="false" />
		<property name="hibernate.cache.use_second_level_cache" value="false"/>
		
		<!-- JDBC -->
		<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
		<property name="hibernate.show_sql" value="true"/>
	</properties>
</persistence-unit>

</persistence>
If I switch the javax.persistence.* properties to hibernate specific ones, everything works just fine...

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 27, 2014

Juergen Hoeller commented

Parsing those properties is not the job of the JPA container (i.e. Spring in this case), it is the job of the persistence provider itself. This is known to work with EclipseLink, the reference implementation.

For Hibernate 4.3.6, org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.applyJdbcConnectionProperties() contains corresponding code that converts the standard JPA 2.0 properties to Hibernate's own properties. If this doesn't work for some reason, it's arguably a Hibernate bug. Note that this code only kicks in if no DataSource has been specified in any other way.

Juergen

@spring-projects-issues spring-projects-issues added status: invalid An issue that we don't feel is valid in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: enhancement A general enhancement label Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

2 participants