小编Xav*_*ier的帖子

用于过滤@OneToMany关联结果的注释

我有两个表之间的父/子关系,以及我的Java类中的相应映射.表大致如下:

A (ref number, stuff varchar2(4000))
B (a_ref number, other number, foo varchar2(200))
Run Code Online (Sandbox Code Playgroud)

和Java代码:

@Entity
class A {
    @Id
    @Column(name = "REF")
    private int ref;

    @OneToMany
    @JoinColumn(name = "A_REF", referencedName = "REF")
    private Set<B> bs;
}

@Entity
class B {
    @Id
    @Column(name = "A_REF")
    private int aRef;

    @Id
    @Column(name = "OTHER")
    private int other;
}
Run Code Online (Sandbox Code Playgroud)

这工作正常,但我想在从子表中检索的行上添加一个过滤器.生成的查询如下所示:

select a_ref, other, foo from B where a_ref = ?
Run Code Online (Sandbox Code Playgroud)

我希望它是:

select a_ref, other, foo from B where a_ref = ? and other = …
Run Code Online (Sandbox Code Playgroud)

java hibernate jpa jointable

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

排除发布版本类型的资产

我正在使用gradle构建的应用程序中导入一个android库,如下所示:

dependencies {
    compile 'com.example:great-lib:0.1-SNAPSHOT'
}
Run Code Online (Sandbox Code Playgroud)

此库仅包含要在webview中使用的资源,js,css和图像,其布局如下:

assets/
|-> great.css
|-> great.min.js
|-> great.min.js.map
|-> js/
|   |-> plop.js
|   |-> foo.js
|   ...
|-> img/
|   ...
Run Code Online (Sandbox Code Playgroud)

js文件夹包含源文件(与源映射一起使用).我想包含它和.map调试版本的文件,并且在发布版本中只有缩小的js,但我找不到这样做的方法.

到目前为止,我已经尝试过: 

android {
    // this doesn't exclude anything
    packageOptions {
        exclude 'assets/js'
    }
    buildTypes {
        release {
            // this does exclude the js folder, but in both release and debug
            aaptOptions {
                ignoreAssetsPattern "!js"
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

任何想法是否有可能实现,如果是,如何?

(我也想过发布两个版本的库(great-libgreat-lib-debug),并且依赖于debugCompilereleaseCompile …

android android-gradle-plugin aar

16
推荐指数
3
解决办法
8581
查看次数

标签 统计

aar ×1

android ×1

android-gradle-plugin ×1

hibernate ×1

java ×1

jointable ×1

jpa ×1