问题标签 [grails-orm]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
database - 在 Grails 中存储和编辑键/值对?
我在 Grails 中有一个域对象,它需要为每个实例存储一组键/值对。绝对不能超过 10 对。应用程序的用户必须能够编辑这些键/值对。现在,我正在考虑将域类的每个实例的数据存储在 HashMap 中。虽然我认为这会起作用,但这意味着我必须编写大量自定义代码来编辑、更新和显示这些对象,而不是使用 grails generate-all 生成的代码。有没有更好的方法来存储和编辑键/值对,还是我应该坚持使用 HashMap?
grails - Issue with multiple hasMany relationships to the same domain class when using composite id
I am getting this exception: org.hibernate.MappingException: collection foreign key mapping has wrong number of columns: Room.cellsOrig type: component[locationX,locationY]
I think I am doing the joinTable wrong, but without the joinTables any access to a Room instance's cell or cellOrig properties would cause org.hibernate.HibernateException: null index column for collection: Room.cells
.
Any suggestions for how to do the joinTable in such a way that it can handle the composite id?
grails - GRAILS: Find all children in a self-referenced one-to-many relationship
In grails,
How would one find all the children in a one-to-many relationship e.g.,
Using a single manager, how would one get the subordinates of all subordinates (like traversing a object graph)?
grails - GORM refresh() 方法没有从数据库中获取最新数据
保存更改的用户名(使用flush:true
)后,以下表达式的计算结果为 false:
左侧获取更改后的用户名,而右侧返回“旧”值。
想法?在下一个 HTTP 请求中刷新“u”引用似乎有效。
validation - 在 Grails 中使用 Integer 的大小约束
参考文档说尺寸限制:
使用 Groovy 范围来限制集合或数字的大小或字符串的长度。
当我对整数设置大小约束时,我收到警告
域类 TheClass 的属性 [prop] 具有类型 [java.lang.Integer] 并且不支持约束 [size]。在验证期间不会检查此约束。
医生错了吗?
我知道我可以使用范围,但通常能够更容易地指定数字中的位数而不是实际值(比如社会保险号必须有 7 位或其他任何数字,而不是设定一个范围1000000 - 9999999)。
hibernate - Grails Hibernate Session 只读
我有两个 grails 服务器:
- 服务器 - 具有对数据库的读/写访问权限
- Web - 对数据库具有只读访问权限,每次写入都会向服务器发送请求
问题:如何使 Web 的域对象在应用程序的整个运行过程中只在一个位置(配置文件)读取,而不是写入缓存:每个域类的“只读”映射。
grails - 多对多关系的急切加载 - Grails (GORM)
每本书可以有很多作者。每个作者都可以写很多本书。
现在我什么时候可以做:
现在我想我应该能够带走每个作者并获得与他相关的书籍:
你现在看到它会递归(导致stackoverflow)。有谁知道它是如何工作的,当它进行急切的获取时?
hibernate - Grails 和 Hibernate 的延迟初始化异常
您在 Grails 中遇到的最常见的地方在哪里org.hibernate.LazyInitializationException
,原因是什么,您是如何解决的?
我认为这个例外对于新手来说很多,所以如果你能提供更多的例子,那就太好了。
google-app-engine - How to setup one-to-many unidirectional mapping for grails application on GAE?
I try to perform testing on one-to-many unidirectional mapping for grails application on google app engine (GAE) using JPA. The one-to-many unidirectional mapping I attempt to define is between User and Role class. Unfortunately, I am stuck. Just curious is there any developer out there able to make it work successfully.
Following is my development environment:
- Windows XP Professional
- App Engine SDK 1.2.2
- Grails 1.1.1
- Plugins used: app-engine 0.8.3, gorm-jpa 0.5
The source code located at:
The complete errors stack trace is here:
Please advice. See whether you have any idea on what went wrong…</p>
Thanks.
oracle - Groovy domain mapping
I have a to save a pdf report into an Oracle DB. The report's dataType is a byteArray.
The domain definition is as follows:
}
Unfortunately this defines in the Oracle DB a field which has A RAW data_type and a lenghth of 255.
How should I define this field into the domain class? Should be defined as a BLOB?
If yes, How to do this?
Thanks in advance.