aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How to fill database with initial data? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to fill database with initial data?" Watch "How to fill database with initial data?" New topic
Author

How to fill database with initial data?

Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
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

Joined: May 26, 2003
Posts: 30753
    
156

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
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.
 
Don't get me started about those stupid light bulbs.
 
subject: How to fill database with initial data?