Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Hibernate Architect Concerns

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been going back and forth on the following issue for sometime now but I'd like to get some different opinions. For all of the applications I deal with my java objects do not match up with my database tables nor should they and alot of the differences revolve around Internationalization. Because of this I have two real options, I can create objects that meet both the hibernate and application concerns there by coupling them together. Or I can do what I believe is the appropriate thing and use the hibernate objects simply as data transfer objects and use business layer classes to transfer the data thereby creating a true seperation between my model and the rest of my app.

Does anyone out there have any suggestions or comments on the class organization of these types of apps (usually struts and hibernate) and the difficulties inherent in ensuring that they remain decoupled?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain how internationalization impacts your database design? Have you internationalized you data with seperate tables per language or something like that?


Or I can do what I believe is the appropriate thing and use the hibernate objects simply as data transfer objects and use business layer classes to transfer the data


Not sure I follow. you want to use the Hibernate class as a DTO, plus have something else that is also a DTO? Can you explain?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Billy Bob",

You have two previous warnings about your display name, this is the last before your account is closed.

thanks,
Dave.
 
Billy Bob
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Internationalization... for example, lets say we are dealing with food. That food is organized by Food group and sub group. The food, group and sub-group have different values depending on the language but you want the user to be able to transfer between one language and another so the ID for a food is the same regardless of the language. As a result you have an ID, and the food name in as many languages as you need as a row in your DB. As a hibernate object (as far as I'm aware) you have all those languages present however as a Java object you don't care what language you're using as your food has a name and it's the responsibility of the business layer to populate it according to the Locale. Picture using a POJO in your jsp tags, you want to call name not englishname, frenchname, germanname, etc. depending on what the locale is as that logic is not the role of the jsp page.

This seperates your view and controller POJO's from the details of language implementation and isolates where changes need to be made if new ones are added. In my mind a business class will take the data from a hibernate object populate a POJO depending on the Locale (plus other items) and pass that POJO back to the calling struts action (which puts it in session for the jsp to use). At this point you can change the data access implementation (jdbc, ejb, etc) without altering anything for the struts and up just the business classes.

My question is, is that a reasonable way of doing it? I don't want to end up with my layers to reliant upon each other where one change will affect all portions of the application. I'm just not certain that that is a better way of going about it (or is there something that I'm completely missing that hibernate can accomplish).

Any feedback would be appreciated.

Thanks
 
Marshal
Posts: 67344
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Three strikes, Billy Bob. You should not have ignored David's warning. Your account is now closed.

Please email or PM should you wish to reinstate your account.
[ June 23, 2006: Message edited by: Bear Bibeault ]
 
This is awkward. I've grown a second evil head. I'm going to need a machete and a tiny ad ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!