-->
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.  [ 1 post ] 
Author Message
 Post subject: how to display the single record if the database like this
PostPosted: Sat Jun 29, 2013 7:53 am 
Newbie

Joined: Sat Jun 29, 2013 7:36 am
Posts: 1
my table is Student
sid fname lname subject phno
--- ----- ----- -------- -----
1 vvk v math 4444
1 vvk v read 4444
2 hari h math 5555
2 hari h read 5555
3 kalyan k math 6666
3 kalyan k read 6666
i want to display record like this
1 vvk v math 4444 or 1 vvk v read 4444 here the sid and subject has composite primary key

hstudent.hbm.xml is:
<composite-id>
<key-property name="sid" column="sid" type="string"/>
<key-property name="subject" column="subject" type="string"/>
</composite-id>

<property name="firstname" column="firstname" type="string"/>
<property name="lastname" column="lastname" type="string"/>
<property name="phno" column="phno" type="string"/>



my pojo class is:
private String sid;

private String firstname;
private String lastname;
private String subject;
private String phno;
public Student(String sid, String firstname, String lastname, String subject,
String phno) {
super();
this.sid=sid;
this.firstname = firstname;
this.lastname = lastname;
this.subject = subject;
this.phno = phno;
}
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getPhno() {
return phno;
}
public void setPhno(String phno) {
this.phno = phno;
}

1 vvk v math 4444 (or) 1 vvk v read 4444


here my question is how to write a query to display the above result


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

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.