hibernate - i am passing a model class object but it print ad normal object -


i passing hibernate model class object type list prints [ljava.lang.object;@1ec3adc.i using spring mvc , tile hibernate.i want pass "subtab" type list.but it's passing "object" type list.

here's code returning list :

daoimpl :

public list<subtab> listsubtab(int usertype){         list<subtab> subtablist=sessionfactory.getcurrentsession().createquery("select s.maintab, s.description, s.ref subtab s,authintication  s.subtabid = a.subtab , a.usertype = '" + usertype + "'")                 .list();          return subtablist;       } 

controller :

list<subtab> subtablist=(list<subtab>)loginservice.listsubtab(userexists);  model.addattribute("subtabslist",subtablist); 

dao:

public list<subtab> listsubtab(int usertype);    

service :

public list<subtab> listsubtab(int usertype); 

serviceimpl :

 @transactional   public list<subtab> listsubtab(int usertype) {        return logindao.listsubtab(usertype);   } jsp:  <c:if test="${not empty subtabslist}">    <c:foreach var="ob"  items="${subtabslist}">      <p>${ob}</p>     </c:foreach>  </c:if> 

please go through hibernate documentation: https://docs.jboss.org/hibernate/orm/3.6/reference/en-us/html/queryhql.html

queries can return multiple objects and/or properties array of type object[]

if return subtab objects change query to

select s subtab s ...

also please use bind variables in query avoid lot of pitfalls in future.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -