-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Unable to scan package-info.java with hibernate using JPA
PostPosted: Tue Sep 02, 2014 5:08 pm 
Newbie

Joined: Wed Jun 25, 2014 2:06 pm
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: Unable to scan package-info.java with hibernate using JPA
PostPosted: Wed Sep 03, 2014 11:01 am 
Newbie

Joined: Wed Jun 25, 2014 2:06 pm
Posts: 3
Looks like this is a known spring issue:

https://jira.spring.io/browse/SPR-8589

when using the spring LocalContainerEntityManagerFactoryBean. Is anyone aware of a work-around for using package-info.java with hibernate JPA, as opposed to the proprietary hibernate interface?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.