This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!