小编UsT*_*sTa的帖子

EclipseLinkJpaVendorAdapter而不是HibernateJpaVendorAdapter问题

使用由JSF,Spring和Hibernate组成的应用程序.我的示例正常运行,然后当我将class ="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"更改为class ="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter"时,应用程序没有正常运行.有什么问题?他们中的任何一个都是JPA的特殊要求.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee"
       xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
            http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
            http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/context
 http://www.springframework.org/schema/context/spring-context-3.0.xsd
            http://www.springframework.org/schema/jee
 http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
            http://www.springframework.org/schema/tx
 http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<context:annotation-config />
<context:component-scan base-package="com.usta.spring" />
 <tx:annotation-driven />

<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="dataSource" >
    <!-- p:jpaVendorAdapter-ref="jpaAdapter"-->
  <!--  <property name="loadTimeWeaver">
       <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
    </property>     -->

    <property name="jpaVendorAdapter" ref="jpaAdapter">

    </property>
    <property name="persistenceUnitName" value="Spring_PU"/>
</bean>


<bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource"
        p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost/spring"
        p:username="root" p:password="root" />

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>

    <bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="showSql" value="true"/>
        <property name="generateDdl" value="true"/>
        <property …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa

26
推荐指数
1
解决办法
2万
查看次数

@Stateless Session Bean充当@Singleton Bean

我试着用EJB Session Beans做一个例子.我想看看它们之间的差异.我的基本项目图如下;

http://img109.imageshack.us/img109/8262/85220418.png

项目就像一个购物车.当我调用托管bean以通过注入的EJB获取添加的Urun对象的结果时,结果列表必须是最后一个Urun对象.因为我的EJB是@Stateless bean.但是,当我运行应用程序时,它会保留所有新添加的Urun对象.但它是无国籍的,它必须在每个动作中保留最后一个Urun对象.然后,当我在其他网络浏览器中打开应用程序页面时,它会列出之前添加的Urun对象的列表.但是在我的模型中,托管bean和Ejb是无状态的.但它扮演一个Singleton bean.我的问题在哪里?

@Stateless
public class AlisverisSepetiEJB {

    List<Urun> urunler=new ArrayList<>();

    public List<Urun> getUrunler() {
        return urunler;
    }

    public void setUrunler(List<Urun> urunler) {
        this.urunler = urunler;
    }

    public void urunEkle(Urun urun){
        urunler.add(urun);
    }

}
Run Code Online (Sandbox Code Playgroud)
@ManagedBean(name="bean")
@RequestScoped
public class JSFYonetimliNesne {

    public JSFYonetimliNesne(){
        System.out.println("Yönetimli nesne çal??t?");
    }

   @EJB
   AlisverisSepetiEJB alisverisSepeti;

   Urun urun=new Urun();
   List<Urun> urunler;


    public List<Urun> getUrunler() {
        return alisverisSepeti.getUrunler();
    }

    public void setUrunler(List<Urun> urunler) {
        this.urunler = urunler;
    }

    public Urun getUrun() {
        return urun; …
Run Code Online (Sandbox Code Playgroud)

java singleton stateless ejb-3.0

3
推荐指数
1
解决办法
652
查看次数

Sonar 3.0安装错误

我已经将Sonar 3.0安装到我的服务器机器上,但是生成了这个错误代码.

STATUS | wrapper  | 2012/05/09 15:05:31 | --> Wrapper Started as Console
STATUS | wrapper  | 2012/05/09 15:05:31 | Launching a JVM...
INFO   | jvm 1    | 2012/05/09 15:05:31 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO   | jvm 1    | 2012/05/09 15:05:31 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
INFO   | jvm 1    | 2012/05/09 15:05:31 | 
INFO   | jvm 1    | 2012/05/09 15:05:31 | 2012-05-09 15:05:31.792:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
INFO   | jvm 1    | 2012/05/09 …
Run Code Online (Sandbox Code Playgroud)

sonarqube

1
推荐指数
1
解决办法
2846
查看次数

Jquery Ajax/GET方法成功时没有发生任何事情

我有一个在Glassfish Application Server上运行的RESTful Web服务.当我在cURL上使用/ GET HTTP方法调用Web服务时,存储的条目将被提取到控制台.我想创建一个jQuery REST客户端 - 当我单击该按钮时,它必须提醒我返回的JSON或XML条目.但在成功方法中,没有任何反应.我的html页面如下所示.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ba?l?ks?z Belge</title>

</head>

<body>
<input type="submit" name="kaydet" id="kaydet" value="Kaydet" />
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
var restURL="http://localhost:43842/KodcuComRESTful/kodcuRS/yazilar";

$('#kaydet').click(function(){
      $.ajax({
    type: 'GET',
    url: restURL,
    dataType:"json",
    success: renderList,
      });
      return false;
});


function renderList(data) {
    alert(data);
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我在Live HTTP头程序中观察到请求和响应时,似乎一切正常.问题是什么? 在此输入图像描述

jquery get http

1
推荐指数
1
解决办法
3万
查看次数

标签 统计

java ×2

ejb-3.0 ×1

get ×1

hibernate ×1

http ×1

jpa ×1

jquery ×1

singleton ×1

sonarqube ×1

spring ×1

stateless ×1