Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

database entry for user defined classes

 
nitinram agarwal
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement to make entry to the database for all the custom classes(other than standard ones provided by Java),whenever these are loaded in the application. I can think of the following approach

-- have static block in all the user defined classes
-- write the required database loading part in the static block.

Do you think that there is a better approach for this?

Regards
 
Campbell Ritchie
Sheriff
Pie
Posts: 48968
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our databases forum.

I suggest you have classes which simply connect to the database, taking care of any concurrency problems. Then use those classes for all database access. I presume you have read the relevant Java™ Tutorials section?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic