• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple native SQL

 
S Setty
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you help me to find what i am doing wrong.
I can't seem to get this working.

Query simpleQuery = session.createSQLQuery("select LEGACY_ACCT_IN as legacyIndicator FROM DB2.ACCOUNT_DETAILS WHERE ACCESS_MEDIUM_NO = :acctNum").addEntity(SimpleVO.class);

simpleQuery.setString("acctNum", "4889");

List lst = simpleQuery.list();

Exception data: org.hibernate.MappingException: Unknown entity: common.stmt.business.domain.SimpleVO

Thanks
Santosh
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you declared the SimpleVO class in the Hibernate configuration file?
 
S Setty
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying.

No i do not have anything in the hibernate config file. I was thinking addEntity method will register.

Do you have an example or syntax handy?

Appreciate your help.

Thanks
Santosh
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is very important. Below is an example.

 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!