问题列表 - 第47123页

将超类和子类映射到 Hibernate 中的不同表

我想将一个类映射到一个表,将一个子类映射到另一个表。我不确定你是否能以正确的方式做到这一点。到目前为止我尝试过:

@javax.persistence.Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "MyTable1")
public class MyClass

@javax.persistence.Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "MyTable2")
public class MySubclass extends MyClass
Run Code Online (Sandbox Code Playgroud)

它有效,但在生成的 SQL 中,两个表都连接在一起,我想将它们分开。

另一种方法是使用与上面相同的方法,但将 JOINED 更改为 TABLE_PER_CLASS。这不起作用,因为当我查询MyClass时,SQL 中的两个表上都有 UNION ALL 。

我也尝试使用@org.hibernate.annotations.Entity(polymorphism = PolymorphismType.EXPLICIT)and@org.hibernate.annotations.Entity(polymorphism = PolymorphismType.IMPLICIT)但没有效果。

所以我的问题是是否有办法在 Hibernate 中映射它。有什么建议么?

谢谢!


使用休眠3.6.1

hibernate

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

如何使用参数集合格式化std :: string?

是否可以格式化std::string传递一组参数?

目前我正在以这种方式格式化字符串:

string helloString = "Hello %s and %s";
vector<string> tokens; //initialized vector of strings
const char* helloStringArr = helloString.c_str();
char output[1000];
sprintf_s(output, 1000, helloStringArr, tokens.at(0).c_str(), tokens.at(1).c_str());
Run Code Online (Sandbox Code Playgroud)

但是矢量的大小是在运行时确定的.是否有任何类似的函数sprintf_s采用参数集合并格式化std :: string/char*?我的开发环境是MS Visual C++ 2010 Express.

编辑: 我想实现类似的东西:

sprintf_s(output, 1000, helloStringArr, tokens);
Run Code Online (Sandbox Code Playgroud)

c++ string-formatting variadic-functions stdstring

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

从Silverlight中的LayoutRoot中查找控件

我的usercontrol上有多个文本块Layoutroot问题是如何通过名称找到特定的TextBlock?

感谢名单

silverlight

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

"Lync Server 2010 SDK"/"UCMA 3.0 SDK"/和UCC API有什么区别?

我正在寻找Lync 2010的客户端和服务器端API.但我找到了许多能够开发的API.任何人都有什么区别?请帮忙


Microsoft Lync Server 2010 SDK http://www.microsoft.com/downloads/en/details.aspx?FamilyID=58ccf6fd-31db-4f15-bafb-c5ef28afc5fc

Microsoft统一通信托管API 3.0软件开发工具包 http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4493BAAB-6214-4770-8CF9-69C813E8A9FA

Microsoft Unified Communications Client API SDK

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=82c468da-3294-4ca9-bbcc-d455cfd06af2

ocs ucma uccapi lync

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

无提示MSI卸载不存在的GUID

我试图实现我的应用程序的安静卸载.如果实际安装了应用程序,则此方法很有用,但是当用户收到错误消息时,必须单击"确定"继续.

我的命令:

__PRE__

问题是我需要在AD中部署的脚本中清理应用程序的所有旧版本.我不知道在什么计算机上安装了什么版本,并且首先让脚本确定是困难的.

如何让MSIEXEC 不要抱怨卸载不存在的GUID?

windows-installer uninstall batch-file

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

iphone切换像Android的按钮

我在android中创建了一个切换按钮,我使用了一个选择器来改变在开启和关闭背景之间切换的背景.

我的问题是如何使背景保持在它将被点击的状态,例如,如果我按下"on",背景应该保持在"on"背景状态,但在我的情况下,一旦我停止按下按钮,它恢复到原始背景.

有谁知道如何实现它?

这是我的选择器文件:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/off" /> <!-- default -->
    <item android:state_pressed="true" android:drawable="@drawable/on" /> <!-- on state -->   
    <item android:state_focused="false" android:drawable="@drawable/off" /> <!-- off state -->
</selector>
Run Code Online (Sandbox Code Playgroud)

android

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

layoutinflator有什么用?

我是一名新的Android开发人员.我试图从文档中了解布局充气机的使用但却无法理解.android中的布局充气器有什么用?

一个人必须使用它的情况是什么?

android android-layout android-inflate

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

如何在哈希中插入哈希哈希?

我想从一个空哈希开始,然后在哈希中插入相同类型的哈希哈希.

#!/usr/bin/perl

use strict;
use warnings;

my %h = {};

$h{"1"} => {
    a => -1,
    b => -1,
    c => [
    {
        d => -1,
        e => -1,
    },
    ],
};
Run Code Online (Sandbox Code Playgroud)

但是这给了

Useless use of hash element in void context at ./hash.pl line 8.
Useless use of anonymous hash ({}) in void context at ./hash.pl line 8.
Reference found where even-sized list expected at ./hash.pl line 6.
Run Code Online (Sandbox Code Playgroud)

它是一种我想做的数据库,我可以在其中插入这种删除结构$h{"1"}.

任何想法如何做到这一点?

arrays perl hash

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

Arrayadapter.getcount null point exception

我收到以下堆栈跟踪(下面是一个完整的副本),这给了我很少或没有说明其中,在海量应用是会错时和用户的反馈是什么超越"坠毁".

有什么我可以做的更精确地指出这一点吗?

java.lang.NullPointerException at android.widget.ArrayAdapter.getCount(ArrayAdapter.java:291)
    at android.widget.AdapterView.checkFocus(AdapterView.java:689)
    at android.widget.AdapterView$AdapterDataSetObserver.onInvalidated(AdapterView.java:813)
    at android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java:43)
    at android.widget.BaseAdapter.notifyDataSetInvalidated(BaseAdapter.java:54)
    at android.widget.ArrayAdapter$ArrayFilter.publishResults(ArrayAdapter.java:469)
    at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:282)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:4701)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud)

arrays android

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

使用WIA自动化扫描多个页面

我在玩WIA自动化,我一次都无法扫描多个页面。谁能给我一些有关如何实现这一目标的提示?以下是我用于扫描文档/图像的代码示例:

public static byte[] ScanImage(int colourType, string formatId, int dpi)
    {
      _dialog = new CommonDialogClass();
      _scanner = _dialog.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, false, false);     

  foreach (Property item in _scanner.Items[1].Properties)
  {
    switch (item.PropertyID)
    {
      case 6146: //4 is Black-white,gray is 2, colour 1   
        SetProperty(item, colourType);
        break;
      case 6147: //dots per inch/horizontal    
        SetProperty(item, dpi);
        break;
      case 6148: //dots per inch/vertical          
        SetProperty(item, dpi);
        break;
      case 6149: //x point where to start scan   
        SetProperty(item, 0);
        break;
      case 6150: //y-point where to start scan  
        SetProperty(item, 0);
        break;
      case 6151: …
Run Code Online (Sandbox Code Playgroud)

c# wia scanning

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