Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Problem loading bootstrap data
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
KR  
View profile  
 More options Nov 1 2011, 3:06 pm
From: KR <rvkish...@gmail.com>
Date: Tue, 1 Nov 2011 12:06:58 -0700 (PDT)
Local: Tues, Nov 1 2011 3:06 pm
Subject: Problem loading bootstrap data
I am trying to load some bootstrap data into the database on
Application startup. I have the following class which does that.

-------------------------------------
@OnApplicationStart
public class Bootstrap extends Job<Bootstrap> {
    public void doJob() {
        try{
                if (Installation.count() == 0) {
                        Logger.debug("Loading data.............");
                        Fixtures.loadModels("initial-data.yml");
                        Logger.debug("Done!");
                }
        }
        catch(Exception exc)
        {
                exc.printStackTrace();
                Logger.error("exception caught!!"  + exc);
        }
    }

}

----------------------------------------------------------------

initial-data.yml
---------------------------------
Installation:
   name: "HNC-1"
   installCode: "HNC-1"
   description: "Installation -1"

Installation:
   name: "HNC-2"
   installCode: "HNC-2"
   description: "Installation -2"
-----------------------------------------------------------

Installation model class
--------------------------
@Entity
@Table(name = "installation",uniqueConstraints =
@UniqueConstraint(columnNames = {"name", "install_code"}))
public class Installation extends Model{

    @Required
    public String name;

    @Required
    @Column(name="install_code")
    public String installCode;

    public String description;

    public Installation(String name, String installCode, String
description) {
        this.name = name;
        this.installCode = installCode;
        this.description = description;
    }

}

---------------------------------------------

 The class is getting called fine and the data import seems to happen,
but I don't see anything saved in the database.

Any ideas as to why this is happening?

Thanks in advance.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff  
View profile  
 More options Nov 1 2011, 11:50 pm
From: Jeff <jeff.tho...@gmail.com>
Date: Tue, 1 Nov 2011 20:50:29 -0700 (PDT)
Local: Tues, Nov 1 2011 11:50 pm
Subject: Re: Problem loading bootstrap data
Are you seeing NULL values in the DB. I am having a similar problem
with just NULL values being populated. The same .yml file I have works
file when called from tests.

Cheers,
jeff

On Nov 1, 7:06 pm, KR <rvkish...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
KR  
View profile  
 More options Nov 2 2011, 12:33 am
From: KR <rvkish...@gmail.com>
Date: Tue, 1 Nov 2011 21:33:54 -0700 (PDT)
Local: Wed, Nov 2 2011 12:33 am
Subject: Re: Problem loading bootstrap data
Nope, I see nothing at all in the database. BTW, I am using Play 1.2.3

On Nov 1, 8:50 pm, Jeff <jeff.tho...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mikael  
View profile  
 More options Nov 2 2011, 1:27 am
From: Mikael <mikael.bel...@gmail.com>
Date: Tue, 1 Nov 2011 22:27:43 -0700 (PDT)
Local: Wed, Nov 2 2011 1:27 am
Subject: Re: Problem loading bootstrap data

Is Installation in the models package? If in a subpackage you need to add
it to the yml file.
Also make sure you are using spaces in your yml file, not tabs.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
KR  
View profile  
 More options Nov 2 2011, 3:33 am
From: KR <rvkish...@gmail.com>
Date: Wed, 2 Nov 2011 00:33:00 -0700 (PDT)
Subject: Re: Problem loading bootstrap data
Yes, the Installation class is in the models package. The yml file
does have spaces and not tabs. When I deliberately insert tabs, Play
barfs as expected during the import.

On Nov 1, 10:27 pm, Mikael <mikael.bel...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ronald Haring  
View profile  
 More options Nov 2 2011, 8:40 am
From: Ronald Haring <ronald.har...@gmail.com>
Date: Wed, 2 Nov 2011 05:40:45 -0700 (PDT)
Local: Wed, Nov 2 2011 8:40 am
Subject: Re: Problem loading bootstrap data

Your classes in the yml need  some kind of identifier, e.g.:

Installation(first):
   name: "HNC-1"
   installCode: "HNC-1"
   description: "Installation -1"

Installation(another):
   name: "HNC-2"
   installCode: "HNC-2"
   description: "Installation -2"

Also the quotes are not needed.

Regards
Ronald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
KR  
View profile  
 More options Nov 2 2011, 12:37 pm
From: KR <rvkish...@gmail.com>
Date: Wed, 2 Nov 2011 09:37:46 -0700 (PDT)
Local: Wed, Nov 2 2011 12:37 pm
Subject: Re: Problem loading bootstrap data
Thanks much! That was indeed the issue.

On Nov 2, 5:40 am, Ronald Haring <ronald.har...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »