- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经在运行grails 2.5.0的grails项目中成功设置了 flex 搜索插件。我可以搜索并获得结果。但是对结果的某些操作是不可能的,例如在一个域上调用通过GORM的findBy与另一个域进行交互的方法...
鉴于Foo类
class Foo {
static searchable = true
def getBars() {
return Bar.findAllByFoo(this)
}
}
class Bar {
Foo foo
static searchable = true
}
def result = Foo.search("Some parameter")
def foo = result.searchResults.first()
def bars = foo.bars //Fails
object references an unsaved transient instance - save the transient instance before flushing: org.example.Foo. Stacktrace follows:
Message: object references an unsaved transient instance - save the transient instance before flushing: org.example.Foo
Line | Method
->> 105 | methodMissing in org.grails.datastore.gorm.GormStaticApi
def foo = Foo.get(1)
def bars = foo.bars //Works
最佳答案
To map a parent/child relationship, the child element must either contain the parent element as a component or reference it as a referenced document. This component must be mapped as a parent in the child element.
Example:
class ParentElement {
…
}
class EmbeddingChild {
ParentElement parentElement
static searchable = {
parentElement parent: true, component: true
}
}
class ReferencingChild {
ParentElement parentElement
static searchable = {
parentElement parent: true, reference: true
}
}
关于grails - 对Grails中的Elastic Search结果调用findBy…时发生TransientObjectException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35505586/
我正在使用以下代码来初始化我的 Hibernate 搜索索引: EntityManager em = ... FullTextEntityManager fullTextEM = Search.get
这与this post有关,您将在其中找到许多我的配置。 ldap用户被映射到数据库用户表,并且条目创建良好。然后,userDetails尝试从主用户类获取权限,从而导致以下异常: 2014-01-3
我试图在 Tridion 中发布一个页面,并在“提交部署”阶段不断收到以下 NHibernate 异常: Retried 10 times to commit and failed, org.hibe
我有一个错误让我发疯。当我尝试创建新对象时,Hibernate 返回错误: object references an unsaved transient instance - save the tra
当我尝试更新对象时出现以下异常: org.hibernate.TransientObjectException: object references an unsaved transient inst
我有两个类: Employee.java @Entity @Table public class Employee { @Id @GeneratedValue private
每当我进行连续保存时,我都会收到 TransientObjectException;我在第一次保存或刷新屏幕/页面时没有收到此错误。这让我很困惑,因为一旦对象被成功保存,它就不应该是暂时的,因为它在我
简单的Groovy \ Grails代码: def start = { source.save() def result = getJson(hotelSite, en
当我尝试保留对象 Municipio 时,出现异常。Municipio 与 Provincia 具有多音关系,与 Sector 具有多对一关系。Provincia 不能为 null,但 Sector
我有一个像这样的对象层次结构(忽略所有字段,如 id、setters/getters 等): @Entity class A { @OneToOne(cascade=CascadeType.A
我使用的是 Hibernate 4.1,每当我尝试存储已添加到对象集合中的临时标记列表时,我都会收到以下异常。 org.hibernate.TransientObjectException: obje
我有两个名为学生和类(class)的实体,它们具有多对多关系。正如我在this中读到的那样文章中我们可以调用 save 方法来保存事务中的相关实体,或者一旦 session 被刷新它就会被保存。我也明
@Entity @Table(name = "PE_HOME") @Cacheable public class Home extends DefEntity implements IHome {
我的应用程序通过套接字连接接收频繁的远程事件,每次都启动一个新线程,后续操作通常每次都会触发相同的对象图进行保存,并带有一个锁定的静态 session 。但是在执行保存时,有时会收到新的更新,这会将新
我正在将 jpa 与 play 框架一起使用。我有一个实体 JobseekerDetails @Entity public class JobseekerDetails { @Id @
使用 spring-boot (2.1.8.RELEASE),我有一个看起来像这样的测试: @Test @Transactional public void myTest()
在使用 hibernate 更新记录时,我不断收到以下异常,我对 hibernate 非常陌生,请查看该异常跟踪 java.lang.IllegalStateException: org.hibern
我在一个使用 Hibernate Entity Manager 的项目中工作,一切都很好,直到我开始在我们的实体中实现乐观锁。 例如,我们有以下命名查询返回一个人的地址: @NamedQuery(na
我在 hibernate 状态下有一对多关系,如下所示: class Container { @OneToMany( cascade = {CascadeType.ALL}, mappedBy
我有 2 个类 Employe(id,Nom,solde...) 和 Conge(id,duree,...) 我使用注释,并在我的测试类中放置此代码来更新员工的“solde”: Employe p=n
我是一名优秀的程序员,十分优秀!