WebService - 无法初始化代理 - 无会话

WebService - could not initialize proxy - no Session

我尝试通过 WebService 从我的数据库中获取数据列表。我使用 Spring 和 Hibernate 我读过一些话题,比如 This or This

所以我尝试将一些 Transactional 放在 class 的顶部,在我的方法等上,但没有用,或者我没有用正确的参数将正确的东西放在正确的位置。

谢谢,语法不好请见谅

编辑: 我认为问题来自我的 class Personne,它在惰性模式下与许多其他实体一起 link,这是在网络服务上说的意思吗,我不关心这个 link 当我 return 对象时?或者说获取所有

这是我的服务,接口只有@WebService注解


    @WebService(endpointInterface = "eu.enslyon.stella.service.CasMessageService")
    @Service("CasMessageService")
    @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
    public class CasMessageServiceImpl implements CasMessageService {
        private transient Logger logger = LoggerFactory.getLogger(getClass());

        @Autowired
        @Qualifier("CasMessageDao")
        protected CasMessageDao casMessageDao;

        @Autowired
        @Qualifier("IndividuUlrService")
        protected IndividuUlrService individuUlrService;


        @Override
        @Transactional(readOnly = true)
        public List get(String pLogin) {
            BigDecimal persId = individuUlrService.getPersIdFromLogin(pLogin);

            return casMessageDao.get(persId);
        }

    }

我的DAO,接口没有任何注解:


    @Repository("CasMessageDao")
    @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
    public class CasMessageDaoImpl extends AbstractJpaDao implements CasMessageDao, java.io.Serializable {

        /**

         */
        private final static List> dataTypes = new ArrayList>(
                Arrays.asList(new Class[] { IndividuUlr.class }));

        /**

         */
        private static transient Logger logger = LoggerFactory.getLogger(CasMessageDaoImpl.class);

        /**

         */
        @PersistenceContext(unitName = "grhum")
        private EntityManager entityManager;

        /**

         */
        public CasMessageDaoImpl() {
            super();
        }

        /**
         * 
         * @return List>
         */

        public List> getDataTypes() {
            return dataTypes;
        }

        /**
         * 
         * @return EntityManager
         */
        public EntityManager getEntityManager() {
            return entityManager;
        }



        @Override
        public List get(BigDecimal persId) {

            CriteriaBuilder cBuilder = entityManager.getCriteriaBuilder();
            CriteriaQuery criteriaQuery = cBuilder.createQuery(CasMessage.class);

            Root lRoot = criteriaQuery.from(CasMessage.class);

            Join lJoinTypeMessage = lRoot.join("typeCasMessage", JoinType.LEFT);
            Join lJoinPersonne = lRoot.join("detailPersonne", JoinType.LEFT).join("personne",
                    JoinType.LEFT);

            lRoot.fetch("typeCasMessage");
            lRoot.fetch("detailPersonne").fetch("personne");

            criteriaQuery.where(cBuilder.and(cBuilder.isNull(lRoot. get("dEnd")),
                    cBuilder.lessThanOrEqualTo(lRoot. get("countignore"),
                            lJoinTypeMessage. get("nbAffichage")),
                    cBuilder.equal(lJoinPersonne. get("persId"), persId)));

            Query query = entityManager.createQuery(criteriaQuery);

            List lRes = query.getResultList();

            return lRes;
        }

    }

我的实体:


    @Entity
    @Table(name = "CAS_MESSAGE", schema = "STELLA")
    public class CasMessage implements java.io.Serializable {

        private int idCasMessage;
        private TypeCasMessage typeCasMessage;
        private Date dStart;
        private Date dUpdate;
        private Date dEnd;
        private int countignore;
        private DetailPersonne detailPersonne;

        @Override
        public String toString() {
            return "CasMessage [idCasMessage=" + idCasMessage + ", dStart=" + dStart + ", dUpdate=" + dUpdate + ", dEnd="
                    + dEnd + ", countignore=" + countignore + ", detailPersonne=" + detailPersonne + "]";
        }

        public CasMessage() {
        }

        @Id
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CAS_MESSAGE_SEQ")
        @SequenceGenerator(sequenceName = "STELLA.CAS_MESSAGE_SEQ", name = "CAS_MESSAGE_SEQ", allocationSize = 1)
        @Column(name = "ID_CAS_MESSAGE", unique = true, nullable = false, precision = 8, scale = 0)
        public int getIdCasMessage() {
            return idCasMessage;
        }

        public void setIdCasMessage(int idCasMessage) {
            this.idCasMessage = idCasMessage;
        }

        @ManyToOne(fetch = FetchType.LAZY)
        @JoinColumn(name = "ID_TYPE_CAS_MESSAGE")
        public TypeCasMessage getTypeCasMessage() {
            return typeCasMessage;
        }

        public void setTypeCasMessage(TypeCasMessage typeCasMessage) {
            this.typeCasMessage = typeCasMessage;
        }

        @Temporal(TemporalType.TIMESTAMP)
        @Column(name = "D_START", length = 7)
        public Date getdStart() {
            return dStart;
        }

        public void setdStart(Date dStart) {
            this.dStart = dStart;
        }

        @Temporal(TemporalType.TIMESTAMP)
        @Column(name = "D_UPDATE", length = 7)
        public Date getdUpdate() {
            return dUpdate;
        }

        public void setdUpdate(Date dUpdate) {
            this.dUpdate = dUpdate;
        }

        @Temporal(TemporalType.TIMESTAMP)
        @Column(name = "D_END", length = 7)
        public Date getdEnd() {
            return dEnd;
        }

        public void setdEnd(Date dEnd) {
            this.dEnd = dEnd;
        }

        @Column(name = "COUNTIGNORE", unique = true, nullable = false, precision = 8, scale = 0)
        public int getCountignore() {
            return countignore;
        }

        public void setCountignore(int countignore) {
            this.countignore = countignore;
        }

        @ManyToOne(fetch = FetchType.LAZY)
        @JoinColumn(name = "PERS_ID")
        public DetailPersonne getDetailPersonne() {
            return this.detailPersonne;
        }

        public void setDetailPersonne(DetailPersonne detailPersonne) {
            this.detailPersonne = detailPersonne;
        }

    }


    @Entity
    @Table(name = "TYPE_CAS_MESSAGE", schema = "STELLA")
    public class TypeCasMessage implements java.io.Serializable {

        private int idTypeCasMessage;
        private String message;
        private String url;
        private int nbJour;
        private int nbAffichage;

        public TypeCasMessage() {
        }

        @Override
        public String toString() {
            return "TypeCasMessage [idTypeCasMessage=" + idTypeCasMessage + ", message=" + message + ", url=" + url
                    + ", nbJour=" + nbJour + ", nbAffichage=" + nbAffichage + "]";
        }

        @Id
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TYPE_CAS_MESSAGE_SEQ")
        @SequenceGenerator(sequenceName = "STELLA.TYPE_CAS_MESSAGE_SEQ", name = "TYPE_CAS_MESSAGE_SEQ", allocationSize = 1)
        @Column(name = "ID_TYPE_CAS_MESSAGE", unique = true, nullable = false, precision = 8, scale = 0)
        public int getIdTypeCasMessage() {
            return idTypeCasMessage;
        }

        public void setIdTypeCasMessage(int idTypeCasMessage) {
            this.idTypeCasMessage = idTypeCasMessage;
        }

        @Column(name = "MESSAGE")
        @Lob
        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }

        @Column(name = "URL", length = 500)
        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        @Column(name = "NB_JOUR", unique = true, nullable = false, precision = 8, scale = 0)
        public int getNbJour() {
            return nbJour;
        }

        public void setNbJour(int nbJour) {
            this.nbJour = nbJour;
        }

        @Column(name = "NB_AFFICHAGE", unique = true, nullable = false, precision = 8, scale = 0)
        public int getNbAffichage() {
            return nbAffichage;
        }

        public void setNbAffichage(int nbAffichage) {
            this.nbAffichage = nbAffichage;
        }

    }

追踪:


    org.apache.cxf.interceptor.Fault: Marshalling Error: could not initialize proxy - no Session
        at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:249)
        at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:169)
        at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:111)
        at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
        at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:78)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:144)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:122)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
        at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:170)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)





    Caused by: org.hibernate.LazyInitializationException: could not initialize proxy - no Session
        at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:165)
        at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:286)
        at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:185)
        at eu.enslyon.stella.model.CarteCumul_$$_jvst22d_7.getDDebResto(CarteCumul_$$_jvst22d_7.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.sun.xml.bind.v2.runtime.reflect.Accessor$GetterSetterReflection.get(Accessor.java:347)
        at com.sun.xml.bind.v2.runtime.reflect.Accessor.getUnadapted(Accessor.java:149)
        at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.hasValue(TransducedAccessor.java:247)
        at com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:98)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
        at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:152)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
        at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:152)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:65)
        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:168)
        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:155)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:152)
        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:189)
        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:316)
        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:323)
        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:72)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
        at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:95)
        at org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:532)
        at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:222)
        ... 64 more

Conf for Entity Manager
<pre>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:security="http://www.springframework.org/schema/security"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
      http://www.springframework.org/schema/aop
      http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
      http://www.springframework.org/schema/tx
      http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
      http://www.springframework.org/schema/context 
      http://www.springframework.org/schema/context/spring-context-3.1.xsd
      http://www.springframework.org/schema/jee
      http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
      http://www.springframework.org/schema/security 
      http://www.springframework.org/schema/security/spring-security-3.1.xsd">


<bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="classpath:config.properties" />
</bean>

<!-- Atomikos Transaction Manager -->
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
    init-method="init" destroy-method="close">
    <property name="forceShutdown" value="true" />
    <property name="startupTransactionService" value="true" />
    <property name="transactionTimeout" value="3600" />
</bean>

<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp" />

<!-- JTA transactions from Atomikos -->
<bean id="transactionManager"
    class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManager" ref="atomikosTransactionManager" />
    <property name="userTransaction" ref="atomikosUserTransaction" />
    <property name="transactionSynchronizationName" value="SYNCHRONIZATION_ON_ACTUAL_TRANSACTION" />

</bean>
<!-- Atomikos Data Sources -->
<bean name="grhumDS" class="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean">
    <property name="uniqueResourceName" value="[VALUE]" />
    <property name="url" value="${grhum.connection.url}" />
    <property name="user" value="${grhum.connection.username}" />
    <property name="password" value="${grhum.connection.password}" />
    <property name="driverClassName" value="${grhum.connection.driver_class}" />
    <property name="maxPoolSize" value="150" />
    <property name="borrowConnectionTimeout" value="30" />

</bean>
<bean name="protecDS" class="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean">
    <property name="uniqueResourceName" value="[VALUE]" />
    <property name="url" value="${protec.connection.url}" />
    <property name="user" value="${protec.connection.username}" />
    <property name="password" value="${protec.connection.password}" />
    <property name="driverClassName" value="${protec.connection.driver_class}" />
    <property name="maxPoolSize" value="150" />
    <property name="borrowConnectionTimeout" value="30" />
</bean>

<bean name="sesameDS" class="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean">
    <property name="uniqueResourceName" value="[VALUE]" />
    <property name="url" value="${sesame.connection.url}" />
    <property name="user" value="${sesame.connection.username}" />
    <property name="password" value="${sesame.connection.password}" />
    <property name="driverClassName" value="${sesame.connection.driver_class}" />
    <property name="maxPoolSize" value="150" />
    <property name="borrowConnectionTimeout" value="30" />
</bean>


<!-- vendor adapter -->
<bean id="grhumJPAVendorAdapter"
    class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="showSql" value="${grhum.show_sql}" />
    <property name="generateDdl" value="${grhum.generateDdl}" />
    <property name="databasePlatform" value="${grhum.dialect}" />
</bean>
<bean id="protecJPAVendorAdapter"
    class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="showSql" value="${protec.show_sql}" />
    <property name="generateDdl" value="${protec.generateDdl}" />
    <property name="databasePlatform" value="${protec.dialect}" />
</bean>

<bean id="sesameJPAVendorAdapter"
    class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="showSql" value="${sesame.show_sql}" />
    <property name="generateDdl" value="${sesame.generateDdl}" />
    <property name="databasePlatform" value="${sesame.dialect}" />
</bean>

<bean id="grhum"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="grhumDS" />
    <property name="persistenceUnitName" value="grhum" />

    <property name="jpaVendorAdapter" ref="grhumJPAVendorAdapter" />
    <property name="jpaPropertyMap">
        <map>
            <entry key="hibernate.transaction.manager_lookup_class"
                value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup" />
            <entry key="hibernate.connection.release_mode" value="on_close" />
            <entry key="hibernate.search.default.indexBase" value="${catalina.base}/tmp/indexes" />
            <entry key="hibernate.transaction.jta.platform"
                value="com.atomikos.icatch.jta.hibernate4.AtomikosPlatform" />
        </map>
    </property>
    <property name="packagesToScan" value="eu.enslyon.stella.model" />

</bean>

<bean id="protec"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="protecDS" />
    <property name="persistenceUnitName" value="protec" />

    <property name="jpaVendorAdapter" ref="protecJPAVendorAdapter" />
    <property name="jpaPropertyMap">
        <map>
            <entry key="hibernate.transaction.manager_lookup_class"
                value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup" />
            <entry key="hibernate.connection.release_mode" value="on_close" />
            <entry key="hibernate.search.default.indexBase" value="${catalina.base}/tmp/indexes" />
            <entry key="hibernate.transaction.jta.platform"
                value="com.atomikos.icatch.jta.hibernate4.AtomikosPlatform" />
        </map>
    </property>
    <property name="packagesToScan" value="eu.enslyon.stella.model.protec" />

</bean>


<bean id="sesame"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="sesameDS" />
    <property name="persistenceUnitName" value="sesame" />
    <property name="jpaVendorAdapter" ref="sesameJPAVendorAdapter" />
    <property name="jpaPropertyMap">
        <map>
            <entry key="hibernate.transaction.manager_lookup_class"
                value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup" />
            <entry key="hibernate.connection.release_mode" value="on_close" />
            <entry key="hibernate.search.default.indexBase" value="${catalina.base}/tmp/indexes" />
            <entry key="hibernate.transaction.jta.platform"
                value="com.atomikos.icatch.jta.hibernate4.AtomikosPlatform" />
        </map>
    </property>
</bean>

</beans>

我已经通过将“@XmlTransient”放在 :

上解决了这个问题


     @XmlTransient
     @ManyToOne(fetch = FetchType.LAZY)
            @JoinColumn(name = "PERS_ID")
            public DetailPersonne getDetailPersonne() {
                return this.detailPersonne;
            }

CXF: how to exclude some properties when object sent through SOAP?

我不明白是 CXF 序列化了我的对象并且没有休眠所以我搜索了错误的术语但什么也没找到

我有完全相同的错误。问题是 soap 响应的对象有 link 到 persisted/attached 集合。并且在编组期间它会导致延迟加载异常。我们在转换器中修复了这个问题,只需创建集合的副本。例如:

有错误的旧代码:

soapResponseDto.setBookTypes(entity.getBookTypes);

新固定码:

soapReponseDto.setBookType(new ArrayList<>(entity.getBookTypes));

因此您需要检查 soap 响应 DTO 类 不包含来自实体的任何 类。