-->
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.  [ 4 posts ] 
Author Message
 Post subject: HQL questions
PostPosted: Mon Jul 29, 2013 5:48 am 
Newbie

Joined: Mon Jul 29, 2013 5:31 am
Posts: 3
I have Entity DayProgram

Code:
@Entity
public class DayProgram implements Serializable {

@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne
private DayOfWeek dayOfWeek;


and DayOfWeek

Code:
@Entity
public class DayOfWeek implements Serializable{

@Id
@Column (name = "id")
@GeneratedValue (strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "dayOfWeek")
private String dayOfWeek;


I use a HQL to get all DayProgram where dayOfWeek.getDayOfWeek() = 'Mondey', but I do not understand how to do it

Code:
List<TrainingProgram>  list = getSessionFactory().getCurrentSession().
               createQuery("from TrainingProgram where dayOfWeek.dayOfWeek = 'Mondey' ").list();


It's not work, help me please


Top
 Profile  
 
 Post subject: Re: HQL questions
PostPosted: Tue Jul 30, 2013 1:04 pm 
Newbie

Joined: Mon Jul 29, 2013 5:31 am
Posts: 3
actually


Top
 Profile  
 
 Post subject: Re: HQL questions
PostPosted: Thu Aug 01, 2013 7:37 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi,
You wrote "Mondey" with an "e"
Should be "Monday".

Is that an error in the post or in your code?

Davide


Top
 Profile  
 
 Post subject: Re: HQL questions
PostPosted: Thu Aug 01, 2013 10:33 am 
Beginner
Beginner

Joined: Wed Feb 06, 2013 2:43 am
Posts: 46
Nice catch David. It should work with Monday.

_________________
Thanks,
Ajit Singh
ajits@mindfiresolutions.com
www.mindfiresolutions.com


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