• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
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.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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).
    Bookmark Topic Watch Topic
  • New Topic