-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to build Predicate for the attribute in Embedded Object?
PostPosted: Thu Apr 06, 2017 5:22 am 
Newbie

Joined: Wed Jul 13, 2016 10:40 pm
Posts: 17
Code:
@Etity
public class Person {
    @Id
    private String personId;
    @Embedded
    private CommonInfo commonInfo;
    ....
}

@Embeddable
public class CommonInfo {
   @Column(insertable=false)
   @ColumnDefault("0")
   @Generated(GenerationTime.INSERT)
   private boolean onDelete;

   @Column(insertable=false
         , updatable=false)
   @Generated(GenerationTime.INSERT)
   @ColumnDefault("CURRENT_TIMESTAMP")
   private LocalDateTime createTime;
   
   @Column(insertable=false)
   @ColumnDefault("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
   @Generated(GenerationTime.ALWAYS)
   private LocalDateTime updateTime;
         ......
}


With
CriteriaBuilder builder
, CriteriaQuery<Person> query
, Root<Person> root

, how to build a Predicate that onDelete equals false?

If available, can it be built by Metadata Model?


Top
 Profile  
 
 Post subject: Re: How to build Predicate for the attribute in Embedded Object?
PostPosted: Thu Apr 06, 2017 6:53 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
What have you tried so far?


Top
 Profile  
 
 Post subject: Re: How to build Predicate for the attribute in Embedded Object?
PostPosted: Thu Apr 06, 2017 7:51 am 
Newbie

Joined: Wed Jul 13, 2016 10:40 pm
Posts: 17
vlad wrote:
What have you tried so far?


Problem solved.
get(Person_.commonInfo).get(CommonInfo_.onDelete)
the same as person.commonInfo.onDelete in JPQL

See JPA Specification Section 6.5.5 "Path Navigation"


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.