Folks,

I am trying to seed my database with two default standard entities.

is there a reason why tapestry wont allow me to catch this exception ?

Its really annoying. that I have to comment out and uncomment the code just to 
get my databse seeded properly.

I thought catchign the exception would be sufficient to continue... though I 
feel its a substabntive hack,... i got no other choice.


AppModule.JAVA

    public static void contributeSeedEntity(OrderedConfiguration<Object> 
configuration)
    {
        /**/
        try {
            PersonBuilder pb = new PersonBuilder();
            Person administrator = pb.build();
                administrator.setUsername(Person.Role.administrator.toString());
                administrator.setPassword(Person.Role.administrator.toString());
            Set<Person.Role> roles = new HashSet<Person.Role>();
                roles.add(Person.Role.administrator);
            Set<Person.Permission> perms = new HashSet<Person.Permission>();
                perms.add(Person.Permission.create);
                perms.add(Person.Permission.read);
                perms.add(Person.Permission.update);
                perms.add(Person.Permission.delete);
            administrator.setPermissions(perms);
            configuration.add("administrator", administrator);
            
            AdminLayoutBuilder alb = new AdminLayoutBuilder();
            AdminLayout al = alb.build();
            configuration.add("adminlayout", al);
        } catch (Exception e) {
            
        }
    }
    left outer join
        UploadableMedia uploadable5_ 
            on this_.splash_id=uploadable5_.id 
    where
        (
            1=1
        )
2013-03-29 15:50:11.984:WARN::failed app: java.lang.RuntimeException: Exception 
constructing service 'SeedEntity': Error invoking constructor public 
org.tynamo.seedentity.hibernate.services.SeedEntityImpl(org.slf4j.Logger,org.apache.tapestry5.hibernate.HibernateSessionSource,java.util.List):
 a different object with the same identifier value was already associated with 
the session: [org.tynamo.examples.pphl.model.AdminLayout#1]
2013-03-29 15:50:11.984:WARN::Failed startup of context 
org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@167e003{/,C:\Prototype\Mavenized\Product\tynamo\trunk\tynamo-examples\pphl\src\main\webapp}
java.lang.RuntimeException: Exception constructing service 'SeedEntity': Error 
invoking constructor public 
org.tynamo.seedentity.hibernate.services.SeedEntityImpl(org.slf4j.Logger,org.apache.tapestry5.hibernate.HibernateSessionSource,java.util.List):
 a different object with the same identifier value was already associated with 
the session: [org.tynamo.examples.pphl.model.AdminLayout#1]
    at 
org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
    at 
org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54)
                                          

Reply via email to