小编Lin*_*e81的帖子

没有懒惰地初始化一个角色集合

嗨,我有两个这样的课程:

public class Indicator implements Serializable {
...

    @OneToMany(mappedBy = "indicator",fetch=FetchType.LAZY)
    private List<IndicatorAlternateLabel>  indicatorAlternateLabels;

    public List<IndicatorAlternateLabel> getIndicatorAlternateLabels() {
        return indicatorAlternateLabels;
    }

        public void setIndicatorAlternateLabels(List<IndicatorAlternateLabel> indicatorAlternateLabels) {
            this.indicatorAlternateLabels = indicatorAlternateLabels;
        }
...
    }

public class IndicatorAlternateLabel implements Serializable {
...
 @ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
    @JoinColumn(name = "IndicatorID")
    @XmlTransient
    private Indicator indicator;
...
}
Run Code Online (Sandbox Code Playgroud)

当我像这样使用它们时:

 public MetricTypeDetail getMetricTypeDetail(Integer metricTypeId) {
        Criteria crit = sessionFactory.getCurrentSession().createCriteria(Indicator.class, "sub")
                    .add(Restrictions.eq("number", metricTypeId))
                    .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).setCacheable(true);
        crit.setMaxResults(1);
        Indicator indicator=(Indicator) crit.uniqueResult();
        MetricTypeDetail metricTypeDetail=new MetricTypeDetail(indicator);
        List<IndicatorAlternateLabel> indicatorAlternateLabels = null;
        indicatorAlternateLabels=indicator.getIndicatorAlternateLabels(); …
Run Code Online (Sandbox Code Playgroud)

java hibernate

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

Sparql:变量之间的算术运算符?

嗨我有这样的查询:

SELECT ?a ?b
WHERE
{
?c property:name "myThing"@en
?c property:firstValue ?b
?c property:secondValue ?a
}
Run Code Online (Sandbox Code Playgroud)

我如何划分第一个nuber和第二个?想要这样的事情:

SELECT ?a/?b
WHERE
{
?c property:name "myThing"@en
?c property:firstValue ?b
?c property:secondValue ?a
}
Run Code Online (Sandbox Code Playgroud)

谢谢

sparql

9
推荐指数
2
解决办法
7857
查看次数

JS或Css页面幻灯片在2个完整页面之间转换

我有两个html页面:Page1.html,Page2.html.我想在这两页之间滑动.我发现很多插件和解决方案可以在两个div之间滑动或在容器内滑动,但我需要的是一个完整的页面更改.

我找到了一些东西,但问题是第2页的jquery代码在页面加载时不会触发.我可以使用jQuery mobile但我的项目使用jQuery ui并且它给了我一些冲突...所以我需要别的东西.

该项目应该在iPad上运行,因此拥有可以拖动的滑动页面会很酷.但我很乐意为幻灯片找到一个插件.

谢谢.

javascript jquery css3 transitions

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

在Java序列化中排序xml超类元素

我必须使用JAXB在JAVA中对ParentClass和ChildClass进行分类.ChildClass扩展了ParentClass.当我序列化ChildClass的一个对象时,在生成的XML中,ParentClass属性首先出现,我想首先使用ChildClass属性,然后是ParentClass属性.

这可能吗?

谢谢

java jaxb xml-serialization

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

iframe 中的视口元标记

我有一个带有视口元标记的 html 页面。我正在 iPad 上查看页面,它以正确的视口显示。如果我打开另一个没有视口标签的页面,其中包含指向我的页面的 iFrame,视口标签无效。

这是正确的行为吗?有没有办法让视口标签在 iframe 中工作?

谢谢!

javascript css iframe viewport ipad

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

可点击条形图的Javascript库?

我需要一个Javascript图表工具来构建一个条形图,允许我点击图表栏并获得另一个图表(在弹出窗口或第一个图表下方).我需要的是一个条形图,它触发一个事件,给我一些被点击的列的id.

Dettails

第一个图表的数据应该在页面加载时加载ajax,并且当您单击其中一个列时应加载第二个图表的数据.

一个例子:三月一个条形图和四月一个条形图形图形,当你点击三月形条形图时,你得到第二个图形(下面或弹出窗口中)有两个条形图:一个用于12/03/2011和其他为23/03/2011.

总费用:3月1200日4月300日

3月总费用:12/03/2011 1000 23/03/2011 200

4月总费用:16/04/2011 10 21/04/2011 290

javascript charts

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

在spring中设置xml响应的内容类型

我有这个方法返回一个然后序列化的对象.

我想设置响应的内容类型(例如as application/xml).

我怎样才能做到这一点?

我找到了其他帖子,但他们不清楚如何为xml类型执行此操作

@RequestMapping(value = "/Disco/GetAreasAtLevel", method = RequestMethod.GET)
@ResponseBody
public GetAreasAtLevelResponseElement getAreasAtLevel(@RequestParam("AreaId") String areaId) {
        GetAreasAtLevelResponseElement root = new GetAreasAtLevelResponseElement();
        root.setArea("TEST");
        return root;
    }
Run Code Online (Sandbox Code Playgroud)

这是我的spring-ws-servlet.xml文件

<?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:context="http://www.springframework.org/schema/context"
  xmlns:sws="http://www.springframework.org/schema/web-services"
xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:util="http://www.springframework.org/schema/util"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
  http://www.springframework.org/schema/tx  http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

  <context:component-scan base-package="com.porism"/>

  <sws:annotation-driven/>
    <tx:annotation-driven />

  <util:properties id="sqlProperties" location="classpath:sql.properties"/>

<bean id="OAuth" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
  <property name="schema" ref="schema"/>
  <property name="portTypeName" value="OAuth"/>
  <property name="locationUri" value="/soap/OAuthService/"/>
</bean>

<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    <property name="xsd" value="WEB-INF/OAuthContract.xsd"/>
</bean>

    <bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource" …
Run Code Online (Sandbox Code Playgroud)

java spring-mvc

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

是否可以使用junit进行压力测试?

我是java和Junit的新手,我需要对一组Web服务进行压力测试,现在对于每个Web服务我都有这样的测试:

@Test
public void webServiceTest() {
Integer firstParameter=0;
Integer secondParameter=9;
List<GeoArea> sampleList = kitDAO.myWebServiceToTest(firstParameter, secondParameter);
Assert.assertNotNull(sampleList);
Assert.assertTrue(sampleList.size() > 0);
}
Run Code Online (Sandbox Code Playgroud)

有没有办法用不同的参数同时调用这个测试100次?我会创建100个线程,向它们传递100个不同的参数集并同时启动线程.你认为这有可能吗?你会怎么做?

谢谢

junit automated-tests stress-testing

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

如何使用ZedGraph在列顶部添加文本?

如何在图表中的栏顶部添加一些文本.这是我要添加条形码的代码:

var color = ColorTranslator.FromHtml(row.Colour);
var barItem = graphPane.AddBar(row.Propensity.ToString(), null, Ys.ToArray(), color);
Run Code Online (Sandbox Code Playgroud)

谢谢

zedgraph

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