This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

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.
 
jQuery in Action, 2nd edition
 
subject: How to fill database with initial data?
 
Similar Threads
Face Managed Bean
CMP EJB's and Autonumber Field Problem
Can I use Entity class as my managed bean?
Container managed entity bean
Face managed bean in RAD7