Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

org. hibernate. MappingException: Unknown SqlResultSetMapping  RSS feed

 
Bernardo Hermont
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!