java - Can Spring's LocalContainerEntityManagerFactoryBean be used in a J2SE environment? -



i'm using spring in glassfish , have need configure works outside of container, development purposes.
i'm uncertain of, , couldn't find answer to, whether can use localcontainerentitymanagerfactorybean class without container.
name, localcontainer, seems can in docs says:

factorybean creates jpa entitymanagerfactory according jpa's standard container bootstrap contract

so i'm uncertain issue.

thanks,
ittai

i wanted note spring supports running jpa stuff outside of container, , doesn't require in way of transaction manager. question ask whether using spring's declarative transaction management (e.g., "@transactional").

if are, then need provide implementation of "platformtransactionmanager." here still, not need use full on jta support (as provided atomikos in above example. can use jpatransactionmanager instance (which expects reference entity manager factory) provided not doing "xa" etc. if doing xa, atomikos, or bitronix or of number of other options fine. might @ example http://blog.springsource.com/2011/08/15/configuring-spring-and-jta-without-full-java-ee/ demonstrates how use jta (with jpa , jms, example).

so, reiterating, if you're doing simple jpa (connecting 1 database) don't need jta, , don't need glassfish. if need xa, can still use third party jta provider responder above suggested, , still don't need glassfish.

finally, if wish maintain both glassfish + jta, , separate jpa works locally rapid development on faster container, might consider imminent spring 3.1, features "profiles" allow conditionally define beans per environment (e.g., "production," or "dev," or "cloud," or whatever you'd like.)


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -