• 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

Get Table name from entity name

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using EJB3.0. I have few entityname of my entity. Is there a way to fetch the table name from that entity using proper annotation.

Please Help!!!.


Thanks
Kushagra Bindal
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use @Entity annotation. If this is not you are expecting please post the problem in detail
 
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the need for the table name? How are you using the table name in code? There are @Entity and @Column annotations, but I don't believe they dynamically give you the name of the underlying table.

-Cameron McKenzie
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are situations where it would be very useful to get e.g. the table and column names of an JPA entity.

I must implement a method to serialize a number of different JPA entities into SQL INSERT strings. Sure, you can hard-code the table and colum names, but it would be very nice if they could be retrived from the entity (instance or class).

Is that possible?

 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic