last day (14 days later) » 

3:18 PM
0
Q: HQL Parameter not in Attribute

SarajogI have two entities with a ManyToMany relation. Role Core: @Entity @Table(name = "ROLE") public class RoleCore extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "role_seq_gen") @SequenceGenerator(name = "role_seq_gen", sequenceName = "ROLE_SEQ", i...

 
second query where clause comparison is not looking correct, need to compare at field level.
 
compare at field level? could you say me how to change it so that it should work?
 
like in first query: r.roles .
 
I can't do that because the given list is a parameter and the first query doesn't work so how should that help? I'll show you how I call the method in the second case and you should understand ;)
 
Your result can not be achieve by using attribute level.like this : @Query("select t from #{#entityName} t where t.attribute = ?1") List<T> findAllByAttribute(String attribute);@Query
 
3:19 PM
@Rudra Is that a question or a statement? I have a List of Roles in Rights and now I need every right that doesn't have the given Role in his list. So which attribute should I compare and with what?
 
when you are reading Roles or rights from database , it will have some column correct to make restriction.
 
3:35 PM
@Rudra sry I still don't get what you want to tell me :(
 
@Sarajog can you tell me, Roles & Rights domain object are having some property under it ?
 
you have the complete classes except the getter and setter at my question, what exactly do you need more?
 
yes,
i am trying to tell you, why you can not use those property in your query "column NAME "
 
okay, and why is that?
 
to find out , RightCore is not in RoleCore..
how can you use, direct entity in where clause ?
 
3:48 PM
why can't I refer the list they have of eachother?
I know that I can't access one RoleCore from the RightCore because RightCore has a list of RoleCore but why can't I look I a RoleCore is in this List of the RightCore?
 
if you have already list, then you should write logic in java to read particular object from list
 
List<RightCore> allRights = rightCoreDao.findAll();
List<RightCore> rights = new ArrayList<>();
for (RightCore right : allRights) {
if (right.getToken().startsWith(category) && !role.getRights().contains(right)) {
rights.add(right);
}
}
return rights;
that's what I wanted to achieve with the sql statement
 
i got it
 
because so I have to Iterate through all Rights to get the rights that aren't set to this Role, not really efficient
 
okay
I feel here, you should try with plsql
first read all object then iterate in plsql
Like using cursor ..
 
3:53 PM
or native sql should also work
 
yes
 
but I'm still confused why my query isn't working :/
I don't see anythin wrong in it
 
still i will say, where clause on object ?
not possible to do that..
how can you compare , yar
direct object in sql
definitely you should have some field to compare
am i right ?
i have some work
i have to go to finish that
bye
 
bye
thanks but comparing an object should work
 
i tried my best
to solve your problem from remote
 
3:57 PM
thanks
 
thanks
 

last day (14 days later) »