Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

org. hibernate. MappingException: Unknown SqlResultSetMapping

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ho folks,

I got an error while running a @SqlResultSetMapping based query.

org.hibernate.MappingException: Unknown SqlResultSetMapping [AAA]


My Stateless Bean:



@Stateless
@SqlResultSetMapping(name="AAA",
entities={
@EntityResult(entityClass=com.certification.entity.ejb.User.class,
fields={
@FieldResult(name="cpf", column="cpf"),
@FieldResult(name="name", column="name")
}
)
},
columns={
@ColumnResult(name="cep")
}
)

public class StatelessBean implements StatelessBeanLocal, StatelessBeanRemote {


@PersistenceContext
EntityManager em;

...
...
...


public Object joinUserWithCEP(Integer cpf) {

try {
Query q = em.createNativeQuery(
"SELECT usr.cpf AS cpf, " +
"usr.name AS name, " +
"e.cep AS cep, " +
"FROM User usr, Endereco e " +
"WHERE usr.cpf = "+cpf+" ",
"AAA");

return q.getSingleResult();

}
catch (Exception e) {
System.out.println("Erro:"+e.getMessage());
return null;
}
}

}



I'm invoking the function from a session bean which is looked up inside a servlet:


StatelessBeanRemote sbr = (StatelessBeanRemote) initialContext.lookup("SCBCD/"+StatelessBean.class.getSimpleName()+ "/remote");

Object cepUser = sbr.joinUserWithCEP(new Integer(1234));

StatelessBeanRemote sbr = (StatelessBeanRemote) initialContext.lookup("SCBCD/"+StatelessBean.class.getSimpleName()+ "/remote"); Object cepUser = sbr.joinUserWithCEP(new Integer(1234));

Somebody has any clues?

Thanks
 
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic