membuat native query pada hibernate dan return list object

Native Query pada Hibernate dan nge-return list object, ::

q> Teknologi yang dipake masih tetep zk + hibernate + spring
q> Class yang digunakan adalah org.hibernate.SQLQuery
q> Langsung ke coding bro

public List<Mstmenu> getListMenuByUser(String user){
String st = "select mm.* from MSTROLEACCESS mra " +
" join MSTMENU mm on mm.VMENUID = mra.VMENUID " +
"join MSTROLE mr on mr.VROLEID = mr.VROLEID " +
" where mr.USER = :user and mra.VSTATUS = 'A' " +
"order by mm.vparent,mm.norderer asc";

SQLQuery sq = getHibernateTemplate().getSessionFactory().getCurrentSession()
sq.setString("user", user);

List<Mstmenu> list = sq.list();
return list;

q> Tinggal panggil method getListMenuByUser(String user), dengan parameter user dan akan nge-return List<Mstmenu>

q> Wow

Selamat ber-hibernate

sumber ::


Published by


Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s