boita
boita

Reputation: 103

In Hibernate what is Method chaining?

In a Hibernate context what is meant by Method chaining?

Upvotes: 1

Views: 389

Answers (2)

Bruno Simões
Bruno Simões

Reputation: 721

Method chaining is a programming style supported by many Hibernate interfaces (see @hvgotcodes example). If you do use this coding style, it’s better to write each method invocation on a different line.

SessionFactory sessionFactory = new Configuration()
.configure("hibernate.cfg.xml")
.addResource("test.hbm.xml")
.buildSessionFactory();

Otherwise, it may be difficult to step through the code in your debugger.

Upvotes: 2

hvgotcodes
hvgotcodes

Reputation: 120198

The same thing that is meant in other contexts.

thing.meth1().meth2().meth3()....

Note that meth has to return something that has the method meth2, and so on.

Upvotes: 2

Related Questions