表没有找到Hibernate和HSQLDB(Table Not Found with Hibernate and HSQLDB)

我们使用hibernate entitymanager通过JPA映射我们的实体。 我们正在使用HSQLDB内存数据库进行单元测试。 一切都很好,直到模型的最近重构开始导致以下错误:

17:55:48.516 [main] WARN  o.h.util.JDBCExceptionReporter - SQL Error: -22, SQLState: S0002
17:55:48.517 [main] ERROR o.h.util.JDBCExceptionReporter - Table not found in statement

我无法发布有问题的SQL,但任何人都可以指出上述错误的可能原因吗? 特别是因为我知道代码以前工作过。 好像hibernate因为重构而生成无效的sqls?


We're using hibernate entitymanager to map our entities through JPA. And we are using HSQLDB in-memory database for unit testing. Everything was fine until a recent refactor to the model started causing the following error:

17:55:48.516 [main] WARN  o.h.util.JDBCExceptionReporter - SQL Error: -22, SQLState: S0002
17:55:48.517 [main] ERROR o.h.util.JDBCExceptionReporter - Table not found in statement

I can't post the SQL in question, but can anyone give me pointers as to the possible causes of the above error? especially since I know the code was working before. It seems like hibernate is generating invalid sqls because of the refactor?


原文:https://stackoverflow.com/questions/1442127
2020-05-24 21:05

满意答案

您需要将obj对象放入集合中,而不是控件本身

未经测试:

Dim tbCollection As Collection

Private Sub UserForm_Initialize()
    Dim obj As clsTextBox
    Dim arr
    Dim ctrl

    Set tbCollection = New Collection

    arr = Array(Me.tbAC, Me.tbCR, Me.tbHP) '<< edit: no Set

    For Each ctrl in arr
        Set obj = New clsTextBox
        Set obj.Control = ctrl
        tbCollection.Add obj
    Next

End Sub

You need to put the obj objects in the collection, not the controls themselves

Untested:

Dim tbCollection As Collection

Private Sub UserForm_Initialize()
    Dim obj As clsTextBox
    Dim arr
    Dim ctrl

    Set tbCollection = New Collection

    arr = Array(Me.tbAC, Me.tbCR, Me.tbHP) '<< edit: no Set

    For Each ctrl in arr
        Set obj = New clsTextBox
        Set obj.Control = ctrl
        tbCollection.Add obj
    Next

End Sub

相关问答

更多

如何根据模型类的属性创建一组控件(How to create a group of Controls based on properties of a model class)

您可以使用这样的名称/权限对的集合: public class NamedPermission { public string Name { get; set; } public Permission Permission { get; set; } } public class Role { ... public List<NamedPermission> Permissions { get; } = new List<NamedPermission> ...

销毁控件(Destroy controls)

只要没有任何东西持有对控件的引用,垃圾收集器就会摆脱它,并且你无需担心。 通常,从包含它的集合中删除一个控件,你只需要做。 但是你必须小心事件处理程序。 如果对象A订阅了对象B引发的事件,则对象B保存对对象A的引用。如果您的控件订阅了Canvas.IsEnabledChanged ,则可以将它们从Canvas移除,但Canvas仍将持有对它们可以在IsEnabled发生变化时通知它们,并且不会被垃圾收集。 这是.NET应用程序中“内存泄漏”的最常见原因。 (他们不是真正的内存泄漏,但他们可能是。)...

“无法修改Controls集合,因为控件包含代码块”(“The Controls collection cannot be modified because the control contains code blocks”)

检查“PlaceHolder”是否具有runat=server属性。 这应该已经有所帮助。 您可以通过它的id来解决该控件,而不是使用FindControl。 你的Page.Header.Databind()不工作的原因可能是因为你没有像runat = server那样的头部分,就像你复制的例子一样。 他们在标题中添加了控件,可能会略有不同。 Check if your "PlaceHolder" has a runat=server attribute. That should already ...

删除一组控件(Removing a collection of controls)

首先隐藏面板似乎使控件比清除面板更快消失。 看到这个代码: Option Strict On Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Panel1.Visible = False If Not Panel1.Controls.OfType(Of Button).An...

MS Access中的表单类对象(如控件集合)(MS Access list class objects in a form (like controls collection))

你可以使用一个可公开访问的集合,例如 Dim myObjects As Collection Private Sub Form_Load() Set MyObjects = New Collection MyObjects.Add Obj1, "First Object" MyObjects.Add Obj2, "Second Object" End Sub 那么,在全球范围内: Forms("MyForm").MyObjects("First Object").Pro...

将控件集合与列表进行比较(Compare Collection of Controls with a list)

FlowLayoutPanel (以及其他容器控件)的控件集合不实现IEnumerable<T>而只实现非通用的IEnumerable 。 使用Cast<T> exension方法将IEnumerable转换为IEnumerable<T> 。 然后你可以使用所有充足的LINQ: flowLayoutPanel1.Controls .Cast<Control>() .Where(c => c.Name == "...") .OrderBy(...) ... ...

如何跟踪一组控件中任何控件的编辑(How to keep track of editing in any of the controls from a group of controls)

没有任何选择可以做你所要求的。 如果控件绑定到对象,则可以使用该对象查看它是否有任何更改,假设该对象实现了INotifyPropertyChanged。 另一种方法是以编程方式将处理程序(用于“更改”事件,例如TextBox的TextChanged )添加到映射到设置标志的单个子控件的每个控件。 There aren't really any options that can do what you are asking. If your controls are bound to an obje...

如何使用具有一组控件的类(How to use a Class with a Collection of Controls)

您需要将obj对象放入集合中,而不是控件本身 未经测试: Dim tbCollection As Collection Private Sub UserForm_Initialize() Dim obj As clsTextBox Dim arr Dim ctrl Set tbCollection = New Collection arr = Array(Me.tbAC, Me.tbCR, Me.tbHP) '<< edit: no Set ...

相关文章

更多

Hibernate创建sessionFactory null

请问各位: 我在使用junit进行单元测试的时候,到实例化SessionFactory的时候不成功, ...

hibernate查询

因为最近要做个中型 所以想了解hibernate查询原理 能详细点 最好点点例子 跪谢!!!

关于hibernate的saveorupdate

SysUser和SysUserIM为one-to-one关系。 SysUser.hbm.xml代码如下 ...

HIBERNATE 没反应

String hql=&quot;select dnp_kbn,dnp_nm from WfDnpno ...

Hibernate中如何实现一个model和多个表关联

RT, 如何能不创建额外的对象的前提下,把一个对象拆到多个表中? 问题补充: 示例model p ...

使用Hibernate+solr取代hibernate search

尝试使用solr取代hibernate search的方法,因本人对二者没有全面的了解,对二者都只是使 ...

关于Hibernate级联数据表的存储问题(多对一)

本问题来自Struts2.1权威指南一书第19章例19.4问题,是一个关于Hibernate关联数据表 ...

jpa与hibernate注解混合使用

请问jpa的注解与hibernate的注解能混合使用吗?二者是什么关系?我的意思是我用的是jpa,但是 ...

hibernate中的映射文件

小弟刚刚接触hibernate,其中有多种关联关系,对关联关系在映射文件中的配置不是太熟悉。感觉hib ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本