java - How to auto detect entities in JPA 2.0 -


i pretty sure used sort of auto detection of beans annotated @entity in jpa 2.0 in past not able find out how. how do instead of listing each bean in class xml element in persistence.xml?

since spring 3.1, have option forget persistence.xml altogether, , configure entitymanagerfactory using packagestoscan property, similar this:

<bean id="entitymanagerfactory"        class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean"       p:datasource-ref="datasource"       p:packagestoscan="${jpa.entity.packages}">      <property name="jpavendoradapter">         <bean class="org.springframework.orm.jpa.vendor.hibernatejpavendoradapter"               p:showsql="${hibernate.show_sql}"/>     </property>      <property name="jpaproperties">         <props>             <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>             <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>         </props>     </property> </bean> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -