小编zkr*_*ine的帖子

一个Persistence.xml中的两个持久性单元

我们创建了一些我们所有项目都将使用的库,这些库将提供我们所有系统的基本功能(登录,管理等).但应用程序本身可以使用另一个数据库.

我们所做的是使用两个持久单元创建Persistence.xml.并将所有核心库实体打包在一个名为"LN-model.jar"的jar中,以及在"App-model.jar"中输出测试应用程序的所有实体.但出于某种原因,我们仍然获得以下信息.

无法在名为[gfdeploy#/ Users/zkropotkine/WORK/SeguridadCore/dist/gfdeploy/SeguridadCore-war_war]的模块范围内解析与persistence-context-ref-name [xxxxlistener.InicializadorListener/em]对应的持久性单元.请验证您的申请.

这是我们的Persistence.xml

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="x" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/x</jta-data-source>
    <jar-file>App-model.jar</jar-file>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
    </properties> 
</persistence-unit>

<persistence-unit name="y" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/y</jta-data-source>
    <jar-file>LN-model.jar</jar-file>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties/>
</persistence-unit> 
Run Code Online (Sandbox Code Playgroud)

顺便说一下,我们将Persistence.xml放在jar中,然后添加到我们的企业项目(EAR)中.

java persistence jpa persistence.xml

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

如何在Chart js中为数据集添加偏移量

我能够为X标签添加偏移量,但我想为数据集中的所有点添加偏移量.可能吗?

图表

这是我正在使用的代码:

var myChart = new Chart.Line(ctx, {
    type: 'line',
    data: {
        labels: ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", ""],
        datasets: [{
            data: [5, 10.5, 18.2, 33.9, 121.2, 184.9, 179.9, 196.1, 158.3, 166.3, 66.4, 20.6, null],
            pointLabelFontSize : 4,
            borderWidth: 2,
            fill: false,
            lineTension: .3,
            borderColor: "#f37029",
            borderCapStyle: 'round',
            borderDash: [],
            borderDashOffset: 0.0,
            borderJoinStyle: 'bevel',
            pointBorderColor: "#f37029",
            pointBackgroundColor: "#f37029",
            pointBorderWidth: 1,
            pointHoverRadius: 4,
            pointHoverBackgroundColor: "rgba(220,220,220,1)",
            pointHoverBorderColor: "rgba(220,220,220,1)",
            pointHoverBorderWidth: 2,
            pointRadius: 4,
            pointHitRadius: 10,
            spanGaps: …
Run Code Online (Sandbox Code Playgroud)

charts chart.js

4
推荐指数
2
解决办法
8992
查看次数

双向多对多JPA

我很难接受JPA,希望有人可以帮助我.

我有3张桌子:

  • Rol(CPE_ROL)
  • TipoUsuario(GTV_TIPOUSU)
  • RolTipoUsuario(CPE_ROLTUS - 加入表)

Rol.java

@JoinTable(name = "CPE_ROLTUS", joinColumns = {
    @JoinColumn(name = "CPE_ROLTUS_TIPOUSU_ID", referencedColumnName = "GTV_TIPOUSU_ID")}, inverseJoinColumns = {
    @JoinColumn(name = "CPE_ROLTUS_ROL_ID", referencedColumnName = "CPE_ROL_ID")})
@ManyToMany(fetch = FetchType.LAZY, cascade={CascadeType.REFRESH})
private List<TipoUsuario> tipoUsuarioList;
Run Code Online (Sandbox Code Playgroud)

TipoUsuario.java

@ManyToMany(mappedBy = "tipoUsuarioList", fetch = FetchType.LAZY, cascade={CascadeType.REFRESH})


private List<Rol> rolesDefault;
Run Code Online (Sandbox Code Playgroud)

由于某种原因,角色默认永远不会被填满,我想知道我是否遗漏了一些东西.

提前致谢.

丹尼尔

java mapping jpa eclipselink

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