- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在这里得到一个 Hibernate MappingException,我不知道为什么。
这是我得到的错误:
2014/01/13 23:58:38 [] ERROR GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: com.apporder.User, at table: user_check_in_definition, for columns: [org.hibernate.mapping.Column(user)]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: com.apporder.User, at table: user_check_in_definition, for columns: [org.hibernate.mapping.Column(user)]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: com.apporder.User, at table: user_check_in_definition, for columns: [org.hibernate.mapping.Column(user)]
... 4 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: com.apporder.User, at table: user_check_in_definition, for columns: [org.hibernate.mapping.Column(user)]
... 4 more
Caused by: org.hibernate.MappingException: Could not determine type for: com.apporder.User, at table: user_check_in_definition, for columns: [org.hibernate.mapping.Column(user)]
... 4 more
package com.xxxx
class UserCheckInDefinition {
static constraints = {
daysBetweenCheckIn(inList: [1..60])
remindDaysBefore(inList: [0,1,2,3,4,5])
startDate(nullable: true)
endDate(nullable: true)
lastCheckIn(nullable: true)
nextCheckIn(nullable: true)
checkInAlert(nullable: true)
missedCheckInEmailAlert(nullable: true)
}
static mapping = {
id generator: 'sequence', params: [sequence: 'user_check_in_definition_id_sequence']
}
User user
Boolean enabled = true
Date startDate
Date endDate
Date nextCheckIn // calculated
Date checkInAlert // calculate
Date lastCheckIn
Integer daysBetweenCheckIn = 7
Integer remindDaysBefore = 1 // actual notify days after
@Deprecated
Boolean missedCheckInEmailAlert
}
package com.xxxx
import com.xxxx.utils.Utilities
class User implements Serializable{
transient springSecurityService
static String SERVICE_TG = "TargetGraffiti"
static String SERVICE_TG_LOCAL = "TargetGraffitiLocal"
static constraints = {
username(blank: false, unique: true)
userRealName(blank: false)
passwd(blank: false)
enabled()
phoneNumber(nullable: true)
phoneNumber2(nullable: true)
carrier(nullable: true)
description(nullable: true)
udid(nullable: true)
createdByUdid(nullable: true)
email(nullable: true)
lastReport(nullable: true)
owner(nullable: true)
webservice(nullable: true, inList: [User.SERVICE_TG, User.SERVICE_TG_LOCAL])
signature(nullable: true)
badgeNumber(nullable: true) // udid of unregistered user
trackInterval(nullable: true)
trackColor(nullable: true)
trackIconFileName(nullable: true)
type(nullable: true)
userType(nullable: true)
status(nullable: true)
punchClockStatus(nullable: true)
lastPunch(nullable: true)
lastPunchDate(nullable: true)
domainName(nullable: true)
job(nullable: true)
task(nullable: true)
app(nullable: true)
timeZone(nullable: true)
pushRegIdAndroid(nullable: true)
pushRegIdIphone(nullable: true)
dev(nullable: true)
}
static mapping = {
table 'user_' // user is a postgres reserved word
id generator: 'sequence', params: [sequence: 'user_id_sequence']
reportType cascade: 'none'
report cascade: 'none'
app cascade: 'none'
owner cascade: 'none'
reportTypes type: 'class'
}
static transients = ['pass', 'passwd2', 'facetMap', 'facetMapPlus', 'authorities', 'myRecordTypes', 'myReportTypes', 'accept']
//required
String username
String passwd
String passwd2
String userRealName
//shared
Date dateCreated = new Date()
String email
String phoneNumber // mobile number
String phoneNumber2 // office number
Carrier carrier
boolean enabled = false
boolean registered = false // citizen users are not registered, they don't know their user name and password
boolean deleted = false // virtual delete
String udid
String createdByUdid // udid of phone that created the user
Date lastReport
TimeZone timeZone // added for Zorts
Long qtyReports = 0
// todo: remove tracking fields, moved to UserTrackingDefinition
String trackInterval = "off" // in minutes
String trackIconFileName
String trackColor = "000000" // default black
Long userVersion = 0 // for syncing user data to phone
boolean saveSession = false
//citizen
boolean getReportUpdates = false
boolean getNotices = false
//web
SortedSet applications
static hasMany = [
authorities: Role,
reportTypes: ReportType,
reportTypeSticky: ReportTypeSticky
]
static belongsTo = Application
// todo: owner is a reserved field name, this should be renamed
Application owner // for belongs to one to many - users
boolean emailShow
String description = ''
// todo: clean up the user_ table, remove these columns
Application app // app currently or last logged into
// @Deprecated // replaced with owningReportPath
// Report owningReport // owner of reports for currently selected report type
// ReportType reportType // reportType currently or last chosen
// Report report // report currently or last chosen
// String facets = "" // currently selected facets as map
// String sort = "Newest" // currently select sort field
// Long listOff = 0 // pagination offset for report list
// String listMode = "list" // currently selected list view mode - list, map, photos
String webservice
Photo signature
String badgeNumber
String type
UserType userType
@Deprecated
String status
PunchClockStatus punchClockStatus
String lastPunch
Date lastPunchDate
Boolean accept // user accepted the privacy policy and terms and conditions
String domainName // domain name and port for self registered users
Boolean test = false // denotes a test user which will be deleted automatically and will not charge credit cart
// for punch clock
Report job
Report task
String pushRegIdIphone
String pushRegIdAndroid
Boolean dev = false // for iphone push notifications
// migration to new Spring Security plugin
boolean accountExpired
boolean accountLocked
boolean passwordExpired
protected void encodePassword() {
passwd = springSecurityService.encodePassword(passwd)
}
/** plain password to create a MD5 password */
String pass = '[secret]'
// self registration and subscription users
def beforeInsert() {
encodePassword()
}
def beforeUpdate() {
if (isDirty("passwd")) {
encodePassword()
}
if (username != getPersistentValue('username') ||
userRealName != getPersistentValue('userRealName') ||
description != getPersistentValue('description') ||
type != getPersistentValue('type') ||
registered != getPersistentValue('registered'))
++userVersion
}
def getAppAuthorities() {
List ret = authorities.collect { role -> role.authority }
return ret
}
String toXML() {
StringBuilder sb = new StringBuilder()
sb.append("<user id='${id}'>")
sb.append(Utilities.makeElementCdata("name", userRealName))
sb.append(Utilities.makeElement("performer", hasRole('ROLE_PERFORMER') as String)) // todo: use roles
sb.append(Utilities.makeElement("type", type))
sb.append(Utilities.makeElement("statusId", punchClockStatus?.id as String))
sb.append(Utilities.makeElement("jobId", job?.id as String))
sb.append(Utilities.makeElement("taskId", task?.id as String))
StringBuilder sb2 = new StringBuilder()
String comma = ""
for (UserRole userRole : UserRole.findAllByUser(this)) {
sb2.append(comma).append(userRole.role.authority)
comma = ","
}
sb.append(Utilities.makeElementCdata("roles", sb2.toString()))
sb.append(Utilities.makeElementCdata("filter", filter(0)))
sb.append(Utilities.makeElementCdata("filter1", filter(1)))
sb.append(Utilities.makeElementCdata("filter2", filter(2)))
sb.append("</user>")
return sb.toString()
}
String filter(int level) {
StringBuilder sb2 = new StringBuilder()
String comma = ""
if (owner?.userFilter != null) {
for (UserFilter uf : UserFilter.findAllByLevelAndUser(level, this)) {
sb2.append(comma).append(uf.report.id)
comma = ","
}
return sb2.toString()
}
return null
}
String exportXml() {
StringBuilder sb = new StringBuilder()
sb.append("<user id='${id}'>")
sb.append(Utilities.makeElementCdata("userRealName", userRealName))
sb.append(Utilities.makeElement("type", type))
sb.append(Utilities.makeElement("username", username))
sb.append(Utilities.makeElement("email", email))
sb.append(Utilities.makeElement("phoneNumber", phoneNumber))
sb.append(Utilities.makeElement("getReportUpdates", getReportUpdates))
sb.append(Utilities.makeElement("getNotices", getNotices))
sb.append(Utilities.makeElement("dateCreated", dateCreated?.toString()))
sb.append(Utilities.makeElementCdata("carrier", carrier?.name))
sb.append(Utilities.makeElement("deleted", deleted))
sb.append(Utilities.makeElement("udid", udid))
sb.append(Utilities.makeElement("createdByUdid", createdByUdid))
sb.append(Utilities.makeElement("enabled", enabled))
sb.append("<roles>")
for (UserRole userRole : UserRole.findAllByUser(this)) {
sb.append(Utilities.makeElement("role", userRole.role.authority))
}
sb.append("</roles>")
if (owner?.userFilter != null) {
sb.append("<userFilter>")
for (UserFilter uf : UserFilter.findAllByUser(this)) {
sb.append(Utilities.makeElement("id", uf.report.id))
}
sb.append("</userFilter>")
}
sb.append("</user>\r\n")
return sb.toString()
}
boolean hasRole(String role) {
return getAppAuthorities().contains(role)
}
Set<Role> getAuthorities() {
if (id == null) return []
if (userType != null)
return userType.authorities
else
return UserRole.findAllByUser(this).collect { it.role } as Set
}
String username(String server) {
String ret = username
if (server == "saveyourbooty.com" || server == "www.saveyourbooty.com") {
ret = username.replace("SYB:", "")
}
return ret
}
void decorateUsername(String server) {
if (server == "saveyourbooty.com" || server == "www.saveyourbooty.com") {
username = "SYB:${username}"
}
}
boolean hasReportType(ReportType reportType) {
boolean ret = false
for (ReportType rt : reportTypes) {
if (rt.id == reportType.id) {
ret = true
break
}
}
return ret
}
TimeZone timeZone() {
if (timeZone != null)
return timeZone
return owner.timeZone ?: TimeZone.default
}
}
最佳答案
我想通了。
问题是依赖问题。我需要 Grails 的 postgresql 扩展来从 postgresql 数据库读取数据类型。
这在 BuildConfig 中做到了:
compile ":postgresql-extensions:0.6.1"
关于hibernate - 映射异常 : Could not determine Type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21103804/
我很难找到正确的搜索语法:) 作为作业的一部分,我正在为 Android 开发一个国际象棋游戏。 我想使用按钮。 我画了棋盘,可以选择一个按钮(即我要移动的棋子)。 我可以点击一 block (按钮)
我有两个类,一个依赖于硬件,一个不依赖于硬件(我们分别称它们为 HardwareDependent 和 HardwareIndependent)。硬件相关类扩展了硬件独立类。现在我有另一个类,它至少必
在这里得到一个 Hibernate MappingException,我不知道为什么。 这是我得到的错误: 2014/01/13 23:58:38 [] ERROR GrailsContextLoad
我想了解 RODBC 如何确定新创建的 (Access) 表的列类型? sqlSave 的 R 文档非常神秘:“类型是通过咨询参数 varTypes 和 typeInfo 来选择的”。并且没有这个论点
我有一个具有定义高度的 div,并且 overflow:scroll; 。它的内容太长,因此出现滚动条。 现在是发痒的部分。它的一些内部 HTML 总是奇怪地出现(准确地说,是 tableFilter
场景 某些 SQL 代理作业计划全天每隔几分钟运行一次。 在某些情况下,它会错过下一个计划,因为它仍在按照上一个计划运行。 每隔一段时间,作业可能会“挂起”。这不会产生失败(因为作业尚未停止)。发生这
目前我使用这个解决方案来加载资源: URL url = MyClass.class.getClassLoader().getResource("documents/"+path); if(url ==
我正在尝试使用nRoomAllocationId在房间传输和房间部门映射类上实现多对一和一对多双向映射。 房间转移类 @Entity @Table(name="roomtransfer") publi
我有一个来自类的 print 方法: public void print(EditorPanePrinter epp) { try { PrinterJob pj=Printe
确定文件所在目录的好方法是什么?我会使用 realpath(),但这会返回符号链接(symbolic link)指向的文件或目录的绝对路径。 例如,如果参数是文件的基名,并且 lstat() 返回 0
我有一个名为 account 的抽象类,如下所示 - abstract class Account { private int number; private String owner
我一直在编写一个打开 Firebird 数据库的小型 Python 应用程序。 为了实现此目标,我使用嵌入的 Firebird 2.5.7.27050,64 位。 尽管如此,无论何时我尝试使用 Pyt
我有一个非常有趣的(至少对我而言)问题要解决(而且,不,这不是家庭作业)。它等同于:您需要确定用户在他的计算机前进行的“ session ”和“ session 开始和结束时间”。 您将获得进行任何用
从 iOS8 开始,您需要注册并提示用户使用本地通知。因此,我想实现一种方法来仔细检查这些权限。 如何检查本地通知设置是否未确定/未设置?到目前为止,我只知道如何检查本地通知是否被granted 或d
在我的应用程序中,我使用 Google In-app Billing Version 3 API 实现应用内购买。在我的应用程序的日志中,我看到: D/Finsky (26024): [1204]
我的小部件有几个 ImageButtons,为它们设置 onClicked 事件,我使用 PendingIntent: Intent intent = new Intent(context, Upda
推送到 github 工作正常。我认为当我从 github checkout 一个分支时,这个问题就开始了。我该如何解决?当我现在尝试推送到 github 时,出现错误“无法确定当前分支。” 此外,我
我正在尝试使用表数据导入向导工具将一个 csv 文件导入到我的数据库中,导入到只有一个属性(它的 ID VARCHAR(10))的表中,导入失败并向我显示此错误:error我检查了 csv 文件以查找
我正在尝试将一些随机生成的数字“合并”在我之前拥有的值向量中的相邻值之间定义的间隔之间。所以基本上,我有以下几点: vectorA包含从 101 到 0 的 101 个值。 我生成一个名为 x 的随机
我要执行一个脚本file.R使用 Rscript .在 file.R ,我使用包dplyr . # file.R df outputFile.Rout 2>&1 但是,如果我添加 default-p
我是一名优秀的程序员,十分优秀!