Visualize EJB in JSF / J2EE

Hi, I want to visualize the content of an EJB in JSF. My sample EJB is an entity class of a database table. As long as the data in the table is the data I want to present everything seems no problem, but what if this is different. For example I have a table 'address'. Lets suppose that the column of the country is a numeric code ( 1 for germany, 2 for spain and so on ). Now I want, that the web page does not show the numeric code but the text value. In an tomcat servlet application I would create a database-view , fetch a resultset from that view in a servlet an iterate through the columns and pack the into some html elements. How can this be done in an J2EE applikation via JSF? Where do I access my database? Via JSF and the controllers ? Or do I have to map my view to an own class?

Regards

Volker Jordan

[836 byte] By [vjordan03a] at [2007-11-27 2:22:34]
# 1

You usually access the database and retrieve data in the data-tier. Map the results to -for examle- List<DTO> where each DTO represents one row of the database table and pass it to the backing beans in the business-tier. Let them pass it -unchanged or wrapped in a DataModel- to a h:dataTable in a JSF page in the web-tier.

BalusCa at 2007-7-12 2:27:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Does this mean, that I have to write database specifiy code? What if I want to be database vendor independant? Cant I access a database not the same way as I access database tables with my entity classes?
vjordan03a at 2007-7-12 2:27:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Sorry in the last sentence I forgot the view:Cant I access a database view not the same way as I access database tables with my entity classes?
vjordan03a at 2007-7-12 2:27:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
You don't need to write DB-specific code when you're using an externally configurable ORM, for example Hibernate.
BalusCa at 2007-7-12 2:27:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
Ok, but this means, that I have to map a java class with getter methods to the database view. Am I right?
vjordan03a at 2007-7-12 2:27:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...