facebook

How to get a value from Hibernate List ?

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #240773 Reply

    pcleung
    Member

    Query query = session.createQuery(
    “select Vipdata from com.nscorp.hibernate.Vipdata Vipdata where vipName = :name order by Vipdata.vipName”);
    query.setString(a_parameter);
    return query.list();

    It is expected that sometimes no result will be selected.

    In the JSP, I try to get a column value from a row.
    Assume only one row will be selected.

    List vipList = VipService.getInstance().getVipdataList(‘AAA’);
    String a = vipList.get(1).toString();

    But the IndexOutOfBoundsException appears

    How to get a column value from Hibernate List when the result contains data or not?

    Thanks

    #240815 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    #240868 Reply

    snpe
    Member

    String a = vipList.get(1).toString();

    call
    String a = vipList.get(0).toString();

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: How to get a value from Hibernate List ?

You must be logged in to post in the forum log in