Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to fill database with initial data?

 
Krystian Gor
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using NetBeans 6.9.1 + Glassfish3. My table generation strategy is <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
My attempt to fill database with required data is to create @ApplicationScoped managed bean. Then inside @PostConstruct public void init() method declare some objects and persist them to database.
Then this Managed Bean is useless, but it will still be using memory.
Any advices how to solve it better?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't use "drop-and-create-tables" in production. I would create the database separately so I don't lose my data by accident later.
 
Krystian Gor
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right. I forgot to mention it's not production I still learn, read JSF specification, debug a lot so "drop-and-create-tables" is useful.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic