English 中文(简体)
别树例外的解放和意外结束
原标题:Hibernate and Unexpected end of Subtree exception

I m a newbie to Hibernate.

我有<代码>ItemPOJO,其中载有Set<String>, 包括标签。 标签载于<代码>Item表的另一数据库表,因此我加入该表。

我试图从“Java Persistance with Hibernate”一书中找到一个简单的例子。 只是出于某种原因,我正在获得一个机会。

 `org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree[from /*qualified class path*/.Item item where  hello  member of item.labels]`

这一问题可能是什么?

这里是我的POJOs:

public class Item
       private int uuid;
       private Set<String>labels = new HashSet<String>();

       @Id
       public int getUuid(){
          return uuid; 
       }

       @CollectionOfElements
       @JoinTable(name="labels", joinColumns=@JoinColumn(name="uuid"))
       @Column(name="label")
       public Set<String> getLabels(){
            return labels;
       }
 }
最佳回答

收集原始物品时,你应使用总部电话系统,如:

from Item item join item.labels lbls where  hello  in (lbls)

PS:之所以需要加入,是因为标签是“一色”或“许多图曼”变量,则需要括号,因为 l是一种收集。

问题回答

从环绕来看,你的参数收集似乎是空洞的。 d 在提问之前,我加上了一个空洞的检查。

教训是,谷歌是你的朋友。 当你能够发出错误信息时,试图将其打入谷歌(或你喜欢的发动机)。 你们不可能是第一个被混淆的人。

波尔图指挥员保留使用非专利物体。 你可以做两件事。 您可创建如下:

SQLQuery sQuery = session.createSQLQuery("select * 
                                          from item_table it 
                                          inner join label_table lt 
                                          where it.id = lt.item_id 
                                          and lt.label =  hello ");
sQuery.list();

或者,你可以开设一个名为<条码>的栏目

from Item item, Label label
where label member of item.labels
      and label.label =  hello 

希望:

根据对bug HHHHH-5209的评论,这一例外是从类似的JPQL query中得出的,即认为这里正确的形式是:

select item from Item item where  hello  in elements(item.labels)

关键职能是<条码>。 这或许比尤里的建议简单,因为它避免了明确加入。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签