小编Mar*_*arc的帖子

"in subselect"的休眠标准

我正在尝试这样做,但使用Criteria而不是HQL:

select user from User where user in (
    select user from UserDomain where domain.id = "XXX"
)
Run Code Online (Sandbox Code Playgroud)

用户是与one-to-many联接表UserDomain 有关系的实体.这里的要点只是找到链接到Domainid ="XXX"的用户.

这看起来应该很简单......但到目前为止,我没有运气任何有用的文档.

nhibernate hibernate criteria subquery

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

Vue/Nuxt:如何定义一个所有组件都可以访问的全局方法?

我只想能够打电话

{{ globalThing(0) }}
Run Code Online (Sandbox Code Playgroud)

在模板中,无需在每个 .vue 文件中定义 globalThing。

我已经尝试了各种插件配置(或 mixins?不确定 Nuxt 是否使用该术语。),但都无济于事。看来不管我做什么,globalThing并且this.globalThing仍然不确定。

在某些情况下,我什至可以在 Chrome 中调试并看到这this.globalThing确实是定义的……但无论如何代码崩溃了,我发现这很难解释。

这是我多次尝试之一,这次使用插件:

nuxt.config.js:

plugins: [
    {
        src: '~/plugins/global.js',
        mode: 'client'
    },
],
Run Code Online (Sandbox Code Playgroud)

global.js:

import Vue from 'vue';
Vue.prototype.globalFunction = arg => {
    console.log('arg', arg);
    return arg;
};
Run Code Online (Sandbox Code Playgroud)

并在 .vue 文件中的模板中:

        <div>gloabal test {{globalFunction('toto')}}</div>
Run Code Online (Sandbox Code Playgroud)

和...结果:

TypeError _vm.globalFunction 不是函数


这是一个不同的想法,使用 Vuex 商店。

商店/ index.js:

export const actions = {
    globalThing(p) {
        return p + ' test';
    }
};
Run Code Online (Sandbox Code Playgroud)

.vue 文件模板:测试结果:{{test('fafa')}}

.vue 文件脚本: …

plugins mixins vue.js nuxt.js

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

流星消耗了大量的Mongo连接

过去几周我们一直在讨论这个问题.

每隔几天,我们的compose.io Mongo db的连接数达到近5000,这是连接限制.此行为似乎没有任何特定触发器.

日志看起来像这样:

2018-08-14T00:02:32.000+00:00 aws-eu-west-1-portal.9.dblayer.com mongodb320: syslogd.25 | 212.233.54.22 65418 [13/Aug/2018:23:57:32.327] ft_mongodb/1: Timeout during SSL handshake
2018-08-14T00:02:32.000+00:00 aws-eu-west-1-portal.9.dblayer.com mongodb320: syslogd.25 | 212.233.54.22 65247 [13/Aug/2018:23:57:32.343] ft_mongodb/1: Timeout during SSL handshake
2018-08-14T00:02:32.000+00:00 aws-eu-west-1-portal.9.dblayer.com mongodb320: syslogd.25 | 212.233.54.22 64999 [14/Aug/2018:00:02:32.346] ft_mongodb/1: Connection closed during SSL handshake
2018-08-14T00:02:32.000+00:00 aws-eu-west-1-portal.9.dblayer.com mongodb320: syslogd.25 | 212.233.54.22 63983 [14/Aug/2018:00:02:32.348] ft_mongodb/1: Connection closed during SSL handshake
2018-08-14T00:02:32.000+00:00 aws-eu-west-1-portal.9.dblayer.com mongodb320: syslogd.25 | 212.233.54.22 62910 [14/Aug/2018:00:02:32.350] ft_mongodb/1: Connection closed during SSL handshake
2018-08-14T00:02:32.000+00:00 aws-eu-west-1-portal.9.dblayer.com mongodb320: syslogd.25 | 212.233.54.22 65460 …
Run Code Online (Sandbox Code Playgroud)

connection-pooling compose-db mongodb meteor

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

当调试命中断点时,Eclipse Luna会给出NullPointerException

每当我在代码中遇到断点时,我都会看到一个令人讨厌的对话框,通知我"透视切换作业遇到了问题",其详细信息只是说"NullPointerException".错误日志显示此堆栈跟踪:

java.lang.NullPointerException
    at org.eclipse.ui.internal.WorkbenchPage.showPart(WorkbenchPage.java:1298)
    at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1269)
    at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:4144)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:4140)
    at org.eclipse.debug.internal.ui.views.ViewContextService.showViewQuiet(ViewContextService.java:1168)
    at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager$4.runInUIThread(PerspectiveManager.java:528)
    at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager$MyUIJob$1.run(PerspectiveManager.java:229)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Run Code Online (Sandbox Code Playgroud)

我已经尝试通过Options/Run/Debug/Perspectives禁用透视切换(我不想要)通过将"Debug"透视图设置为"None",但它会一直重置为"Debug",并且不会改变这种行为.

这非常烦人,使得调试几乎无法使用.

我尝试将-clean添加到eclipse.ini,正如此处所建议的那样,当我调试服务器时,Myeclipse会抛出一些错误 ......但这也没有任何影响.

想法?

eclipse debugging nullpointerexception perspective

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

Vue/Nuxt:如何让组件真正动态化?

为了使用动态定义的单页组件,我们使用component标签,因此:

<component v-bind:is="componentName" :prop="someProperty"/>

...

import DynamicComponent from '@/components/DynamicComponent.vue';

...
components: {
    DynamicComponent
},

props: {
    componentName: String,
    someProperty: null,
}
Run Code Online (Sandbox Code Playgroud)

问题是,这根本不是很动态,因为我们可能想在这里使用的每个组件不仅需要静态导入,而且还需要在components.

我们尝试这样做,至少是为了避免导入所有内容的需要:

created() {
    import(`@/components/${this.componentName}.vue`);
},
Run Code Online (Sandbox Code Playgroud)

但当然这失败了,因为似乎DynamicComponent必须在到达之前定义created()

我们如何使用真正动态的组件,即在运行时导入和注册,仅给出其名称?

dynamic vue.js nuxt.js vue-dynamic-components

5
推荐指数
2
解决办法
5702
查看次数

为什么 org.hibernate.dialect.PostgreSQLDialect 不能转换为 org.hibernate.dialect.Dialect?

在 hibernate.xml 中,我有:

<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
Run Code Online (Sandbox Code Playgroud)

这就是我想做的:

final Session sess = sessionFactory.openSession();
Transaction tx = null;
try {
    tx = sess.beginTransaction();
    Collection<Rfc> rfcs;
    Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Rfc.class);
    criteria = criteria.add(Restrictions.like(Rfc.RFC_IDENTIFIER, input.replace('*', '%')));
    rfcs = criteria.list();
    // ...
    tx.commit();
} catch (final Exception e) {
    if (tx != null) {
        tx.rollback();
    }
    throw new IllegalArgumentException(e);
} finally {
    sess.close();
}
Run Code Online (Sandbox Code Playgroud)

这一切看起来非常简单,但我得到:

引起原因:java.lang.ClassCastException:org.hibernate.dialect.PostgreSQLDialect 无法在 org.hibernate.service.jdbc.dialect.internal 处转换为 org.hibernate.dialect.Dialect。

这是我的 pom.xml 的相关部分:

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <!--            <version>4.1.9.Final</version>-->
        <version>4.1.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>3.6.3.Final</version>
    </dependency>
    <dependency> …
Run Code Online (Sandbox Code Playgroud)

postgresql hibernate

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

从本地路径添加Cordova插件到Meteor

我创建了一个Cordova插件,我需要将其添加到我的Meteor项目中.我尝试了各种形式:

meteor add cordova:/local/path/to/plugin
Run Code Online (Sandbox Code Playgroud)

我也试过将这个插件提交给git,这样我就可以尝试这样的事情:

meteor add cordova:https://marcadonis@bitbucket.org/project/pluginname.git@1.0.0
Run Code Online (Sandbox Code Playgroud)

Meteor回复:

Meteor需要精确版本(例如https://marcadonis@1.0.0),带有SHA引用的Git URL或本地路径.

当然,如果我只知道如何,我会很乐意使用本地路径.

这个"meteor add"命令是否记录在某处?

plugins cordova meteor

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