wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Finding entity column length using JPA annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Finding entity column length using JPA annotations" Watch "Finding entity column length using JPA annotations" New topic
Author

Finding entity column length using JPA annotations

Doug Slattery
Ranch Hand

Joined: Sep 15, 2007
Posts: 294
Hi folks,

I've been looking for a solution to this problem and have only found examples using mapping.

[Edit]Fat fingered something.

I need to format the output of a result set to certain column lengths based on the DDL declared length.

If for instance my entity named "USER" has:

I'd like to do something like:

This is a simple example of how I'd like to do it and realize there's more elbow grease involved, but hopefully it makes sense.

Anyone done anything like this before?

[Edit] Forgot to mention I'm using Hibernate.

Thanks,
-Doug

-- Nothing is impossible if ImPossible
Marcelo Astudillo
Greenhorn

Joined: Aug 08, 2011
Posts: 1
Hi, I need the same and I have found a solution that retrieves the annotation from the class in a managed bean procedure. I can't retrieve some annotations from database, even I have to define in the class. I'm work with Netbeans 6.9.1.

Greetings
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Finding entity column length using JPA annotations
 
Similar Threads
hibernate mapping question
MetaData framework
Serializable two times within a entity?
Edit primary key, if it's a foreign key
Automatically Persisting non existing entity in One To One mapping