ebean-orm-tools / ebean-eclipse-enhancer

Eclipse plugin for Ebean ORM enhancement
3 stars 7 forks source link

Eclipse Query bean enhancement doesn't work without registering default static instance #11

Open turbospaces opened 4 years ago

turbospaces commented 4 years ago

Running JUnit test from eclipse with Query Bean enhancement always fails with

Caused by: javax.persistence.PersistenceException: The default Database has not been defined? This 
is normally set via the ebean.datasource.default property. Otherwise it should be registered programmatically via registerServer()
    at io.ebean.Ebean$ServerManager.getDefaultServer(Ebean.java:98)
    at io.ebean.Ebean$ServerManager.access$300(Ebean.java:48)
    at io.ebean.Ebean.getDefaultServer(Ebean.java:184)
    at io.ebean.DB.getDefault(DB.java:75)
    at io.ebean.typequery.TQRootBean.<init>(TQRootBean.java:130)
    at core.model.query.QCrossCurrency.<init>(QCrossCurrency.java:1)

Running same test from maven works. Only registering Ebean as default instance helps, but causes another issues: if there are 2 ebean server instances defined, it's not possible to use this hack neither, since they collide.

Probably outdated agent version inside plugin?

rbygrave commented 4 years ago

Probably outdated agent version inside plugin?

Probably. The alternative for eclipse is to register the javaagent to the JRE Runtime.

If you look at: https://ebean.io/docs/getting-started/ ... and then click on the "Eclipse IDE" tab, that shows screen shots of registering the javaagent with the JRE. Then run the project using that JRE (and turn off the plugin).

Do you want to try that?