-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: @ManyToMany with formula in annotation, possible?
PostPosted: Fri Mar 04, 2011 2:06 pm 
Newbie

Joined: Thu Jun 01, 2006 2:15 am
Posts: 7
Hi Forum,

I'm trying to get this work.

I have one table, let's say: User, and Role. User to Role are many to many relation. But there's a flag on Role (deleteDate) to indicate it's been deleted. So, the join relation should have something like: where role.deletedate is NULL (0 in MySQL). Currently, I'm using:
@ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST })
@JoinTable(name = "tbl_userrole", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"))
I need to find a way to add where condition in it. I think formula was for this purpose. But I don't know how can I do that. @Forumla annotation doesn't work in this case.

Any idea?

Thanks

Noodle


Top
 Profile  
 
 Post subject: Re: @ManyToMany with formula in annotation, possible?
PostPosted: Fri Mar 04, 2011 2:40 pm 
Newbie

Joined: Thu Jun 01, 2006 2:15 am
Posts: 7
Forget about it, just figure out I can simply use @Filter with @ManyToMany and @JoinTable

Thanks

Noodle


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.