Ebean getting started challenges

67 views
Skip to first unread message

Chris Mason

unread,
Aug 8, 2019, 1:25:41 PM8/8/19
to eb...@googlegroups.com
Hello!
Thanks for making ebean!  I'm excited about an ORM that is not as complicated as Hibernate. Also, coming from Django, the basic setup and concepts seem quite familiar to me.  So far I'm finding the documentation very good.

I wanted to share a couple snags I ran into while getting started.

Just a heads up that I wasted some time getting started because I pulled a jetbrains Kotlin spring example project and tried to add ebean to it.  The agent is set up to exclude certain "well known" packages from enhancement, and the example had everything in `org.jetbrains`.  It took me a while to figure this out (and to figure out that the plugin was actually running, just ignoring my class).

I'm not sure what I'd recommend to prevent this, maybe the plugin could be more explicit about *why* it was ignoring certain files.  I'd also recommend the help or troubleshooting page that encourages turning the agent debug verbosity all the way up.

I also had some trouble using the latest version (42.2.2).  I ran into an error during gradle setup:

    Cannot execute null+[]

If interesting, I could post more details. Rolling back to version 11.41.1 seems to have fixed this.

Finally, I'm noticing that the DDL generator doesn't escape SQL reserved words like `order`.  

                Caused by:
                java.sql.SQLException: Error executing stmt[create table task (
                  id                            bigserial not null,
                  name                          varchar(150),
                  description                   varchar(150),
                  order                         integer,
                  version                       bigint not null,
                  constraint pk_task primary key (id)
                )] error[ERROR: syntax error at or near "order"
                  Position: 167]
                    at io.ebean.migration.ddl.DdlRunner.runStatement(DdlRunner.java:113)
                    at io.ebean.migration.ddl.DdlRunner.runStatements(DdlRunner.java:70)
 
Obviously, I can work around this by renaming my columns.

Thanks again,

-c

--
Christopher Mason    |     Head of Engineering     |      cma...@navio.com

Rob Bygrave

unread,
Aug 8, 2019, 6:37:04 PM8/8/19
to ebean@googlegroups
Great feedback, thanks !!!

>  and the example had everything in `org.jetbrains`

Wow, you did well to figure that all out - well done.
So yeah, thinking ... (agent enhancement performance re skipping all classes in these well known packages)


> latest version (42.2.2).  I ran into an error during gradle setup


    Cannot execute null+[]

Is there more on this error?  Maybe log a ticket on ebean-gradle-plugin if there is a problem with the latest?


> DDL generator doesn't escape SQL reserved words like `order`.

So yes, Ebean won't use quoted identifiers by default - they should be explicitly specified using backticks (and then Ebean will use the db platform quoted identifiers).  
I'm personally old school Oracle view in that I don't like / encourage the use or reliance on quoted identifiers.  That is, we shouldn't put ourselves into a position of needing to use quoted identifiers (and everyone and all tools from now until forever will be forced to use quoted identifiers for those tables/columns - I don't think that is great).


>  Obviously, I can work around this by renaming my columns.

Yeah. My view is that renaming the column isn't a workaround but instead a long term healthy thing to do.  Either go everything is quoted identifiers or nothing is quoted identifiers but remember ... the database will live FOREVER so my opinion is that generally we should try and make this nice for people dealing with these tables/columns in 20 years from now.

These are my personal opinions / thoughts on this of course - others may disagree.  Ebean used to have a reserved word checker and explicitly complain when we used reserved words that were not quoted ... so maybe we should consider bringing that back in?


Cheers, Rob.

--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/CAEC4bbmeqUcMm5trbdokh4kwCP1gNGigQKwb_BK1CJb1L0VEJQ%40mail.gmail.com.

Rob Bygrave

unread,
Aug 12, 2019, 8:31:02 AM8/12/19
to ebean@googlegroups
FYI:  Updated ebean-agent 11.42.4 to process org.jetbrains package (remove it from the ignore list)

Reply all
Reply to author
Forward
0 new messages