The service is just a hibernate service that saves data to the database. 

public class StudioServiceHibernate implements StudioService {

    private final Session session;

    public StudioServiceHibernate(Session session) {
        this.session = session;
    }

    public Studio save(Studio studio) {
        return (Studio) session.get(Studio.class, session.save(studio));
    }
}

I was looking at the execution order.

First it executes the bind method which binds all the services including 
         
     binder.bind(StudioService.class, StudioServiceHibernate.class);

After that it give control to the 

@Startup
    public static void initApplicationData(DataGenerator dataGenerator) {
        dataGenerator.generate();
    }

which should fill in the database. Since the DataGenerator is created with
the build method it then triggers this method

public static DataGenerator buildDataGenerator() {
        return new DummyDataGenerator();
    }

Which creates generator and then starts to generate the method. Inside it
are the services for filling the database like StudioService which is
injected into the Generator class. However for some reason it is as if the
bind method didn't bind the StudioService to its implementation.

When I remove the buildDataGenerator and manually bind it inside the bind
method all is ok. But when I put it in special method it is not. 

What am I missing? Idea?

Thx for trying to help

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Creating-custom-service-using-build-failed-tp5081119p5081462.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to