• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

generic code to display properties of any pojo

 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello every one,
i am facing a problem where in which i used to get a List object which contains Object[] and i used iterate for a single Object and display it's content. Upto now it's working fine.

But now i am forced to use the particular type of POJO that is being populated into the List object, at any point of time the List will hold only the array of any particular type.

Now how to display the content of every object in the List.

Please help in this regard.
 
Soumyajit Hazra
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain it with some code or more details.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i explain with the code then i guess this form will be moved to hibernate, but i fell that the problem i am facing can be done with java.
OK well i will explain it.
There is a new type in oracle DB which called SD0_GEOMETRY, this particular type is not hibernate core which supported in hibernate-spatial with proper dialects.
The problem with my scenario is i will not know which particular table will be selected by the user (in UI) as i mentioned earlier we have the Objects in the List object which we iterate in the jsp.

Now with the introduction of the new type SD0_GEOMETRY, the hibernate is unable to map the particular type into a generalized one untill being specfied for a particular type, by doing so we get the same type of objects into List.




now how to display the content of the List?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ideally the objects in the list would expose a method to display properties, and each object would be able to customize its display method as necessary.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you make it more clear with an example
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really; just have the objects implement an interface that has a single method for displaying the properties. Call that method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic