Grails应用中的混合关系
我有一个名为 Event
的域类。 活动
报名人数较多,有现场有账号的用户,也有没有现场账号的用户。我希望注册用户能够跟踪他们的事件,因此事件-用户关系应该是双向的(用户由 Spring Security 创建)。仍然有一些注册与用户帐户无关。这很重要,因为活动是一种带有排名的现场比赛,活动结束时活动所有者会更新排名。如何实现这一目标?
I have a domain class which is called Event
. Event
has many registrations, which are users with account on site or people without it. I want registered user to be able to track their events, so Event-User
relationship should be bidirectional (user is created by Spring Security). Still there are registrations which are not connected with user accounts. It's important since event is kind of a live competition with ranking, which is updated by event owner when event is over. How to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该可行:
这样您可以从事件或用户的所有事件中获取用户。
编辑:
将用户添加到事件并
从事件中删除用户并
从事件中获取所有用户
我不太确定您如何处理未注册的用户。您根本没有关于该用户的信息吗(没有用户名等?)
我建议您在用户类“布尔注册”中添加一个标志。
因此,您也可以为未注册的用户创建一个 User 对象。
干杯马努
this should work:
this way you can get the user from the event or all events for the user.
EDIT:
add Users to the Event with
remove Users from Event with
get all Users from Event
I'm not quite sure how you handle the not registered Users. Do you have no information about this users at all (no username etc ?)
I would suggest you add a flag in the User class "Boolean registered".
So you can create a User object for not registered Users also.
cheers manu