Example sourcecode with pitfalls I stumpled upon

34 views
Skip to first unread message

Benjamin Gudehus

unread,
Sep 3, 2012, 1:15:27 PM9/3/12
to eb...@googlegroups.com
Hi, everyone!

I've documented three pitfalls I stumpled upon when using Ebean.

Ebean: Pitfalls I stumpled upon.

- Pitfall #1: Used special characters in the name of ServerConfig
- Pitfall #2: Forgot to implement getters and setters in the entity bean
- Pitfall #3. Connection in QueryIterator wasn't closed

I also created this Short, Self Contained, Correct Example (SSCCE) to provide a very simple 
example to programmatically configure and use Ebean.

Some years ago I provided a patch to the bug "Behavior of NamingConvention for table names" 
and also provided an example on how to disable logging to files completely (this is included in 
the SSCCE).

There is another patch to completely disable generation of textfiles with SQL statements to 
drop and generate tables using DDL in the works.

One currently has to run the DDL manually. Code related:

this.serverConfig.setDdlRun(false);
this.serverConfig.setDdlGenerate(true);

this.ebeanServer = EbeanServerFactory.create(this.serverConfig);
DdlGenerator generator = ((DefaultServer) this.ebeanServer).getDdlGenerator();
generator.runScript(true, generator.generateDropDdl());
generator.runScript(false, generator.generateCreateDdl());

Greetings from Hannover, Germany
Benjamin

Reply all
Reply to author
Forward
0 new messages