I am having trouble configuring JPA global type mappings via the package-info.java file, which looks like this:
Code:
@TypeDefs({
@TypeDef(
typeClass = MyCustomUserType.class,
defaultForType = MyType.class
)
})
package my.entity.package;
import...
My spring configuration file looks like this:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:spring-configured />
<context:annotation-config />
<context:component-scan base-package="my.package"/>
<context:property-placeholder location="classpath:/my.properties" />
<bean id="testDataSource" class="org.apache.commons.dbcp.BasicDataSource"
p:driverClassName="com.ibm.db2.jcc.DB2Driver"
p:url="jdbc:db2://${database.host}:50000/${database.dbname}:currentSchema=I0071DBA;"
p:username="${database.username}"
p:password="${database.password}"
p:initialSize="5"
p:maxActive="10">
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="testDataSource" />
<property name="persistenceProviderClass" value="org.hibernate.jpa.HibernatePersistenceProvider"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true"/>
</bean>
</property>
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.dialect" value="org.hibernate.dialect.DB2Dialect"/>
<entry key="hibernate.default_schema" value="MySchema"/>
<entry key="hibernate.cache.use_query_cache" value="false"/>
<entry key="hibernate.cache.use_second_level_cache" value="false"/>
</map>
</property>
<property name="packagesToScan" value="my.entity.package"/>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
I believe the packagesToScan property is being used, because all my entity classes are configured into the EntityManagerFactory. Only the package-info.java file is not being used. Any suggestions for configuring the package-info.java file into the EntityManagerFactory?
I have used package-info.java successfully using proprietary hibernate interface on a prior project. Is it possible that this is not supported with hibernate/jpa, that this is only a proprietary hibernate feature?
Thanks,
Greg