Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems facing while mapping Value Type and Entity Type Objects in Hibernate Application

 
Nilesh Sanyal
Ranch Hand
Posts: 33
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to create a Hibernate application which will display all records of Orders table. I am

applying concept of Value Type and Entity Type object while mapping to 2 persistent classes named as

OrderDetails and ContactDetails. I am using Oracle 10g Express Edition database in this project.

Table created
---------------
create table orders(order_id number primary key,weekday_recipient varchar2(40),weekday_phone

varchar2(20),holiday_recipient varchar2(40),holiday_phone varchar2(20));

ORDER_ID WEEKDAY_RECIPIENT WEEKDAY_PHONE HOLIDAY_RECIPIENT HOLIDAY_PHONE
---------- ---------------------------------------- -------------------------------------------------------------------------------------
700 New York 56046023 Los Angeles 56036764

OrderDetails.java
--------------------


ContactDetails.java
-----------------------


hibernate.cfg.xml
--------------------


OrderDetails.hbm.xml
-------------------------


index.jsp
-----------


After running the application it is showing only the following output...

700 com.model.ContactDetails@895829 com.model.ContactDetails@1931438

Why it is showing that kind of output? please help.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nilesh Sanyal wrote:Why it is showing that kind of output? please help.

Because the ContactDetails class doesn't override the toString() method from Object...

And off-topic: having Java code in your JSP is considered to be a very, very, very bad practice. A JSP is only intended to show data, not for business logic (e.g. querying a database).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic