Ebean ORM

Overview
Comments
  • Hash values for QueryPlan collide

    Hash values for QueryPlan collide

    I'm using Play 2.2.1, which includes ebeanorm-3.2.2 which I tested against and found (what I believe) this bug.

    I am getting PersistenceExceptions thrown when creating a large set (hundreds) of similar queries in a row. It seems to depend on the data I'm passing in, which unfortunately, I cannot disclose. The queries look very similar, but have varying numbers of parameters in each section. I traced this through the ebean source code (which I repackaged and replaced the jar in my Play repo), and it lead me to believe that the hashes were colliding. I printed the computed hashes of each query, and they did indeed match. It seems that because they hash the same, the same QueryPlan object it being used for both, even though they have differing numbers of bound parameters.

    Both below errors hash to the value: 1336939366

    Before I knew all of this, I attempted to explain what I was seeing over on stackoverflow if you'd like to take a look at that as well. http://stackoverflow.com/questions/20501591/ebean-dynamic-query-prepared-statements-mismatched-parameter-count-error

    Here are the two stack traces:

    play.api.Application$$anon$1: Execution exception[[PersistenceException: Query threw SQLException:No value specified for parameter 19 
    Bind values:[SENT,1290,8988,13032,13052,1290,96,99,100,101,102,103,104,105,106,107,108,222] 
    Query was:
    select distinct t0.contact_id c0, t0.contact_uuid c1, t0.bounce c2 from contact t0 join email_record u1 on u1.contact_id = t0.contact_id  join contact_tag u2z_ on u2z_.contact_id = t0.contact_id  join tag u2 on u2.tag_id = u2z_.tag_id  where u1.status = ?  and t0.unit_id = ?  and u2.tag_id in (?,?)  and t0.unit_id in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )  and t0.campaign_id in (?,?,?,?,?,?,?,?,?,?,?,?)  
    
    ]]
        at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.1]
        at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.1]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
        at scala.Option.map(Option.scala:145) [scala-library.jar:na]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
    Caused by: javax.persistence.PersistenceException: Query threw SQLException:No value specified for parameter 19 
    Bind values:[SENT,1290,8988,13032,13052,1290,96,99,100,101,102,103,104,105,106,107,108,222] 
    Query was:
    select distinct t0.contact_id c0, t0.contact_uuid c1, t0.bounce c2 from contact t0 join email_record u1 on u1.contact_id = t0.contact_id  join contact_tag u2z_ on u2z_.contact_id = t0.contact_id  join tag u2 on u2.tag_id = u2z_.tag_id  where u1.status = ?  and t0.unit_id = ?  and u2.tag_id in (?,?)  and t0.unit_id in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )  and t0.campaign_id in (?,?,?,?,?,?,?,?,?,?,?,?)  
    
    
        at com.avaje.ebeaninternal.server.query.CQuery.createPersistenceException(CQuery.java:798) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.query.CQuery.createPersistenceException(CQuery.java:775) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:205) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:81) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:265) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1469) ~[avaje-ebeanorm.jar:na]
    Caused by: java.sql.SQLException: No value specified for parameter 19
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.PreparedStatement.checkAllParametersSet(PreparedStatement.java:2612) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2587) ~[mysql-connector-java-5.1.27.jar:na]
    

    And the second:

    play.api.Application$$anon$1: Execution exception[[PersistenceException: Error with property[19] dt[4]data[1464][java.lang.Integer]]]
        at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.1]
        at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.1]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
        at scala.Option.map(Option.scala:145) [scala-library.jar:na]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
    Caused by: javax.persistence.PersistenceException: Error with property[19] dt[4]data[1464][java.lang.Integer]
        at com.avaje.ebeaninternal.server.persist.Binder.bindSimpleData(Binder.java:327) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.persist.Binder.bindObject(Binder.java:216) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.persist.Binder.bindObject(Binder.java:173) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.query.CQueryPredicates.bind(CQueryPredicates.java:152) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.query.CQuery.prepareBindExecuteQuery(CQuery.java:382) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:165) ~[avaje-ebeanorm.jar:na]
    Caused by: java.sql.SQLException: Parameter index out of range (19 > number of parameters, which is 18).
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3814) ~[mysql-connector-java-5.1.27.jar:na]
        at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3796) ~[mysql-connector-java-5.1.27.jar:na]
    

    This is affecting our production environment so we need a fix ASAP, so I'm going to attempt to fix this in the ebean source, and if I can, I'll try to submit a patch to this ticket. However, I am very unfamiliar with this code, so if someone has the time I'd really appreciate the help.

    I can provide more data on request. Additionally, I submitted this bug on what I assume to be the old bug system before seeing the dates on the issues there, http://www.avaje.org/bug.html.

    bug 
    opened by jcreason 27
  • jsonContext.toJson(o, generator, path) can not apply path on @Transient field that is an entity bean

    jsonContext.toJson(o, generator, path) can not apply path on @Transient field that is an entity bean

    class Model {
    String a;
    @Transient
    List<ModelB> list;
    }
    Model model = findById(1);
    model.list = find(ModelB.class).select("oneField").findList();
    //path -> (a,list(oneField))
    jsonContext.toJson(o, generator, path)
    //-> {"a":"a",list:[{"oneField":1,"twoField":null}]} should not show `twoField`
    
    bug 
    opened by icode 26
  • Interrupted getting connection from pool java.lang.InterruptedException

    Interrupted getting connection from pool java.lang.InterruptedException

    Ebean version: 7.3.1 Ebean datasource version: 1.1.1

    Reproduce steps:

    1. create an ebean server and use it, all good so far
    2. shutdown the ebean server with shutdownDatasource set to true
    3. create an new ebean server. You get the error stack:
    javax.persistence.PersistenceException: java.sql.SQLException: Interrupted getting connection from pool java.lang.InterruptedException
        at com.avaje.ebeaninternal.server.core.DefaultContainer.checkDataSource(DefaultContainer.java:361)
        at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:102)
        at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:41)
        at com.avaje.ebean.EbeanServerFactory.createInternal(EbeanServerFactory.java:108)
        at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:67)
        at act.db.ebean.EbeanService$2.on(EbeanService.java:61)
        at act.event.EventBus.callOn(EventBus.java:134)
        at act.event.EventBus.callOn(EventBus.java:155)
        at act.event.EventBus.callOn(EventBus.java:171)
        at act.event.EventBus.emit(EventBus.java:189)
        at act.event.EventBus.emit(EventBus.java:180)
        at act.app.App.emit(App.java:504)
        at act.app.App.refresh(App.java:273)
        at act.app.CliSession.run(CliSession.java:90)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.sql.SQLException: Interrupted getting connection from pool java.lang.InterruptedException
        at org.avaje.datasource.pool.PooledConnectionQueue.getPooledConnection(PooledConnectionQueue.java:277)
        at org.avaje.datasource.pool.ConnectionPool.getPooledConnection(ConnectionPool.java:712)
        at org.avaje.datasource.pool.ConnectionPool.getConnection(ConnectionPool.java:700)
        at com.avaje.ebeaninternal.server.core.DefaultContainer.checkDataSource(DefaultContainer.java:351)
        ... 20 more
    
    invalid 
    opened by greenlaw110 25
  • 不知道 ebean 有没有带 where 条件的更新

    不知道 ebean 有没有带 where 条件的更新

    如果有一张订单表, 需要将状态由已创建变更为已支付, 对应的 sql 语句是:

    update t_order set status = 'Pay' where id = xxx and status = 'Create'
    

    然后根据返回的结果是否为 1 来判断更新有没有成功, 从而决定是否将事务进行回滚.

    不想使用 version 的原因在于: 如果有其他的地方在做跟 status 无关的更新操作, 这里的更新将会失败, 还是想基于这一个属性做这种颗粒度的更新, 而且从性能的角度来说, 也多了一次 load version 的查询

    v = select version from t_order where id = xxx
    
    update t_order set status = 'Pay', version = v + 1
    where id = xxx and version = v
    

    虽然也能用 createQuery 的方式完成这个实现

    public void pay(Long id) {
        String delete = "update t_order set status = :new and id = :id and status = :old";
        SqlUpdate update = ebeanServer.createSqlUpdate(delete);
        update.setParameter("id", id);
        update.setParameter("old", "Create");
        update.setParameter("new", "Pay");
    
        if (update.execute() != 1) {
            // rollback...
            return;
        }
    }
    

    但是, 在代码中嵌入 SQL, 多少还是挺难受的, 一旦表名或字段名发生变更(尽管这种情况并不多见)就难受了, 虽然可以挪到 xml, 但是在我看来那样更难受.

    我的意思是, 能不能在 ebeanServer 中添加一个像下面这样的方法:

    public interface EbeanServer {
        ...
        int update(Object newBean, Object oldBean) throws OptimisticLockException;
        ...
    }
    

    这样一来, 调用时, 我只需要

    Order order = new Order();
    order.setStatus("pay");
    
    Order old = new Order();
    old.setId(id);
    old.setStatus("Create");
    
    if (ebeanServer.update(order, old) != 1) {
        log...
    
        // trigger transaction rollback or do anything with business-related operations
        throw new ServiceException("change status fail. please check! order_id: {}", id);
    }
    

    当然, 可能带 where 的条件规则会很多, 不仅仅只是这么简单了. 比如

    update t_order set status = 'Pay'
    where id = xxx and (status = 'Create' or status = 'Confirm')
    
    delete t_system_log where is_delete = 1 and create_time <= '3 month ago'
    

    会有这种需求, 是因为之前我用的 mybatis, 可以用 example 轻松组装出上面的 sql 出来

    opened by liuanxin 23
  • Ebean-elasticsearch paging query problem

    Ebean-elasticsearch paging query problem

    Ebean-elasticsearch defaults to paging from+size.

    However, in the case of deep paging, the efficiency of this method is very low. For example, from=5000,size=10, ES needs to match and sort on each fragment and get 5000*10 valid data, and then return the last 10 data in the result set. In addition to efficiency problems, there is also an unsolvable problem that ES currently supports the maximum skip value of max_result_window, which defaults to 10000, that is, when from+size > When max_result_window, es returns an error.

    So when I was in use Ebean, directly use the text () through the es query, is unable to satisfy my business scenario, because after more than 10000, access to the pager maximum page number is not correct, as far as I know the solution, when paging to hundreds of pages, es can't return data, at this time in order to restore the normal use, We can take an emergency dodge by setting max_result_window to 50000, but this solution is only a temporary fix.

    So how do I properly page through Ebean using scroll, or something else I'm doing wrong, or is there a better solution

    Looking forward to your reply

    opened by UlyssesChou 21
  • Q: Why can't kapt kotlin generate var Set to query bean

    Q: Why can't kapt kotlin generate var Set to query bean

    @Entity
    @Table(name = "sys_user")
    open class SysUser {
        var name: String? = null
    
        @ManyToMany
        var roles: Set<SysRole>? = null
    
        @OneToOne
        @JoinColumn(name = "job_id")
        var job: SysJob? = null
    }
    
    @Generated("io.ebean.querybean.kotlin-generator")
    @TypeQueryBean
    class QSysUser : TQRootBean<SysUser, QSysUser> {
    
      companion object {
        /**
         * shared 'Alias' instance used to provide
         * properties to select and fetch clauses
         */
        val _alias = QSysUser(true)
      }
    
      lateinit var name: PString<QSysUser>
      lateinit var job: QAssocSysJob<QSysUser>
    
      /**
       * Construct with a given EbeanServer.
       */
      constructor(server: EbeanServer) : super(SysUser::class.java, server)
    
      /**
       * Construct using the default EbeanServer.
       */
      constructor() : super(SysUser::class.java)
    
      /**
       * Construct for Alias.
       */
      private constructor(dummy: Boolean) : super(dummy)
    }
    

    lost roles in query bean

    If I replace

    var roles: Set < SysRole >? = null 
    

    for

    val roles: Set < SysRole >? = null
    

    It generates

    lateinit var roles: QAssocSysRole<QSysUser>
    
    bug 
    opened by weiwill 20
  • Ebean agent conflicts with kotlin data classes by wiring with `equals`

    Ebean agent conflicts with kotlin data classes by wiring with `equals`

    Hi, unfortunately ebean-agent probably doing somthing which it should not.

    given

    abstract class SimpleIdentity<T : Serializable>: Identity<T>() {
        final override fun equals(other: Any?) = super.equals(other)
        final override fun hashCode() = super.hashCode()
    }
    

    when

    fun main() {
        println(Employee(1, "2", "2")==(Employee(1, "2", "2")))
    }
    

    we get

    Exception in thread "main" java.lang.VerifyError: class com.example.Employee overrides final method equals.(Ljava/lang/Object;)Z
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	at com.example.MainKt.main(main.kt:5)
    	at com.example.MainKt.main(main.kt)
    

    code attached.

    ebean-agent-issue.zip

    Run it inside Intellij IDEA

    If we remove Entity annotation so ebean does not modify class - it's ok. tried with several gradle and jvm versions. Java 1.8 does not work for sure.

    on hold 
    opened by soberich 20
  • ENH: Add type support for java.nio.file.Path ... such that it stores the underlying URI as VARCHAR/string

    ENH: Add type support for java.nio.file.Path ... such that it stores the underlying URI as VARCHAR/string

    support java.io.File and java.nio.file.Path save to db.

    db data type use Blob, can configure save file bytes or file path.

    add plan column can use for witch read file bytes or file path, both plan use

    and more info last modified, size, filename and more

    enhancement 
    opened by icode 19
  • Using RawSql is not working well if property name of entity is different than the one in @Column(name =

    Using RawSql is not working well if property name of entity is different than the one in @Column(name = "ColName")

    I got a strange issue that I'm pretty sure is a bug; let's say I got a column called LocID in the database, which is mapped to property locationId of an entity mapped using @Column like @Column(name = "LocID") private Long locationId;

    The problem is when I try to make a query using RawSqlBuilder.parse(sql).create() I get an issue of exception related to a property name (Property [locId] not found on) or column name (Invalid column name 'locationId'.). if I tried to select either of LocID or loactionId, other properties are fine, which make me believe it is a bug, that I renamed locationId to locId and worked!

    I tried to rename another field like zipCode to postalCode with @Column(name = "ZipCode") got the same issue on this column too, in short, no issues at all if the property name MATCH the column name.

    I tried columnMapping approach got the same issues, same exceptions.

    Expected behavior

    Selecting a property name in a query should be working fine.

    Actual behavior

    The property name MUST match column name, and can't be selected in any way if they are different.

    Steps to reproduce

    @Entity
    @Sql
    public class LocationExtractedData extends Model {
    
        @Id
        @Column(name = "Id")
        private Integer id;
    
        @Column(name = "ZipCode")
        private String zipCode;
    
        @Column(name = "LocID")
        private Long locationId;
    
        @Column(name = "CompanyName")
        private String companyName;
    
        @Column(name = "Latitude")
        private String latitude;
    
        @Column(name = "Longitude")
        private String longitude;
    
    }
    

    And query part for RawSql

    public CompletionStage<Stream<LocationExtractedData>> list(String[] keys) {
            final String sql = "SELECT id, zipCode, locationId, companyName, latitude, longitude" +
                    " FROM fnGetLocationsSummaryForCompanies(:keys)";
    
            return supplyAsync(() -> {
                        final RawSql rawSql = RawSqlBuilder.parse(sql).create();
                        return Ebean.find(LocationExtractedData.class)
                                .setRawSql(rawSql)
                                .setParameter("keys", String.join(",", keys))
                                .findList()
                                .stream();
                    }
                    , ec);
    
        }
    

    Using SQL Server as you may note in exceptions.

    First attempt (it does not make sense):

     java.util.concurrent.CompletionException: javax.persistence.PersistenceException: Query threw SQLException:Invalid column name 'locationId'. Bind values:[....] Query was:select id, zipCode, locationId, companyName, latitude, longitude FROM fnGetLocationsSummaryForCompanies(?)
    	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
    	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1773)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java)
    	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    	at java.base/java.lang.Thread.run(Thread.java:835)
    Caused by: javax.persistence.PersistenceException: Query threw SQLException:Invalid column name 'locationId'. Bind values:[....] Query was:select id, zipCode, locationId, companyName, latitude, longitude FROM fnGetLocationsSummaryForCompanies(?)
    	at io.ebean.config.dbplatform.SqlCodeTranslator.translate(SqlCodeTranslator.java:52)
    	at io.ebean.config.dbplatform.DatabasePlatform.translate(DatabasePlatform.java:223)
    	at io.ebeaninternal.server.query.CQueryEngine.translate(CQueryEngine.java:149)
    	at io.ebeaninternal.server.query.DefaultOrmQueryEngine.translate(DefaultOrmQueryEngine.java:43)
    	at io.ebeaninternal.server.core.OrmQueryRequest.translate(OrmQueryRequest.java:103)
    	at io.ebeaninternal.server.query.CQuery.createPersistenceException(CQuery.java:701)
    	at io.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:411)
    	at io.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:133)
    	at io.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:451)
    	at io.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1552)
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'locationId'.
    	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
    	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1621)
    	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:592)
    	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:522)
    	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
    	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2935)
    	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248)
    	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223)
    	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:444)
    	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
    [error] h.ExceptionHandlingUtil - @null: Query threw SQLException:Invalid column name 'locationId'. Bind values:[....] Query was:select id, zipCode, locationId, companyName, latitude, longitude FROM fnGetLocationsSummaryForCompanies(?)
    	at actions.RemoteDBAction.lambda$doCall$2(RemoteDBAction.java:81)
    	at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:930)
    	at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:907)
    	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
    	at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:79)
    	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    	at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:49)
    	at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    	at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    	at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    	at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
    Caused by: javax.persistence.PersistenceException: Query threw SQLException:Invalid column name 'locationId'. Bind values:[....] Query was:select id, zipCode, locationId, companyName, latitude, longitude FROM fnGetLocationsSummaryForCompanies(?)
    	at io.ebean.config.dbplatform.SqlCodeTranslator.translate(SqlCodeTranslator.java:52)
    	at io.ebean.config.dbplatform.DatabasePlatform.translate(DatabasePlatform.java:223)
    	at io.ebeaninternal.server.query.CQueryEngine.translate(CQueryEngine.java:149)
    	at io.ebeaninternal.server.query.DefaultOrmQueryEngine.translate(DefaultOrmQueryEngine.java:43)
    	at io.ebeaninternal.server.core.OrmQueryRequest.translate(OrmQueryRequest.java:103)
    	at io.ebeaninternal.server.query.CQuery.createPersistenceException(CQuery.java:701)
    	at io.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:411)
    	at io.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:133)
    	at io.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:451)
    	at io.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1552)
    	at io.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1528)
    	at io.ebeaninternal.server.querydefn.DefaultOrmQuery.findList(DefaultOrmQuery.java:1526)
    ...
    java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    	at java.base/java.lang.Thread.run(Thread.java:835)
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'locationId'.
    	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
    	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1621)
    	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:592)
    	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:522)
    	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
    	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2935)
    	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248)
    	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223)
    	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:444)
    	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
    	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
    	at io.ebeaninternal.server.query.CQuery.prepareResultSet(CQuery.java:377)
    	at io.ebeaninternal.server.query.CQuery.prepareBindExecuteQueryWithOption(CQuery.java:325)
    	at io.ebeaninternal.server.query.CQuery.prepareBindExecuteQuery(CQuery.java:320)
    	at io.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:384)
    	... 12 more
    
    
    

    A second attempt (it does make sense):

    [error] a.PostAction - Direct exception javax.persistence.PersistenceException: Property [locId] not found on models.LocationExtractedData
    java.util.concurrent.CompletionException: javax.persistence.PersistenceException: Property [locId] not found on models.LocationExtractedData
    	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
    	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1773)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java)
    	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    	at java.base/java.lang.Thread.run(Thread.java:835)
    Caused by: javax.persistence.PersistenceException: Property [locId] not found on models.LocationExtractedData
    	at io.ebeaninternal.server.query.CQueryBuilder.createRawSqlSqlTree(CQueryBuilder.java:488)
    	at io.ebeaninternal.server.query.CQueryBuilder.createSqlTree(CQueryBuilder.java:408)
    	at io.ebeaninternal.server.query.CQueryBuilder.buildQuery(CQueryBuilder.java:361)
    	at io.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:377)
    	at io.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:133)
    	at io.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:451)
    	at io.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1552)
    	at io.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1528)
    	at io.ebeaninternal.server.querydefn.DefaultOrmQuery.findList(DefaultOrmQuery.java:1526)
    	at ....LocationExtractedRepository.lambda$list$0(LocationExtractedRepository.java:41)
    [error] h.ExceptionHandlingUtil - @null: Property [locId] not found on models.LocationExtractedData
    	at actions.RemoteDBAction.lambda$doCall$2(RemoteDBAction.java:81)
    	at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:930)
    	at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:907)
    	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
    	at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:79)
    	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    	at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:49)
    	at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    	at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    	at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    	at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
    Caused by: javax.persistence.PersistenceException: Property [locId] not found on models.LocationExtractedData
    	at io.ebeaninternal.server.query.CQueryBuilder.createRawSqlSqlTree(CQueryBuilder.java:488)
    	at io.ebeaninternal.server.query.CQueryBuilder.createSqlTree(CQueryBuilder.java:408)
    	at io.ebeaninternal.server.query.CQueryBuilder.buildQuery(CQueryBuilder.java:361)
    	at io.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:377)
    	at io.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:133)
    	at io.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:451)
    	at io.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1552)
    	at io.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1528)
    	at io.ebeaninternal.server.querydefn.DefaultOrmQuery.findList(DefaultOrmQuery.java:1526)
    	at ...LocationExtractedRepository.lambda$list$0(LocationExtractedRepository.java:41)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1771)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java)
    	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    	at java.base/java.lang.Thread.run(Thread.java:835)
    
    
    opened by almothafar 18
  • @OneToOne with @JoinColumn to non primary key throws `Data conversion error`

    @OneToOne with @JoinColumn to non primary key throws `Data conversion error`

    import com.avaje.ebean.EbeanServer;
    import com.avaje.ebean.EbeanServerFactory;
    import com.avaje.ebean.config.DataSourceConfig;
    import com.avaje.ebean.config.ServerConfig;
    import com.google.common.collect.Lists;
    import org.avaje.agentloader.AgentLoader;
    import org.h2.Driver;
    import org.junit.Before;
    import org.junit.Test;
    
    import javax.persistence.*;
    import java.io.IOException;
    import java.lang.instrument.IllegalClassFormatException;
    
    /**
     * @author icode
     */
    public class EbeanTest {
        EbeanServer server;
    
        @Before
        public void init() {
            AgentLoader.loadAgentFromClasspath("avaje-ebeanorm-agent", "debug=5");
            final ServerConfig config = new ServerConfig();
            config.setClasses(Lists.<Class<?>>newArrayList(RoadShowMsg.class, Company.class));
            DataSourceConfig dataSourceConfig = new DataSourceConfig();
            dataSourceConfig.setUrl("jdbc:h2:file:./db");
            dataSourceConfig.setDriver(Driver.class.getName());
            dataSourceConfig.setUsername("sa");
            dataSourceConfig.setPassword("");
            config.setDataSourceConfig(dataSourceConfig);
            config.setName("default");
            config.setDdlGenerate(true);
            config.setDdlRun(true);
            config.setDefaultServer(true);
            server = EbeanServerFactory.create(config);
        }
    
        @Test
        public void JsonTest() throws IOException, IllegalClassFormatException, ClassNotFoundException {
            RoadShowMsg msg = new RoadShowMsg();
            Company company = new Company();
            company.setCorpId("corp_id_1000000");
            msg.setCompany(company);
            server.save(msg);
            server.find(RoadShowMsg.class, 1);
        }
    
        @MappedSuperclass
        public static abstract class Model {
            @Id
            @GeneratedValue
            public Long id;
    
            public Long getId() {
                return id;
            }
    
            public void setId(Long id) {
                this.id = id;
            }
        }
    
        @Entity
        public static class RoadShowMsg extends Model {
            @OneToOne(cascade = CascadeType.ALL, optional = false)
            @JoinColumn(name = "corp_id", nullable = false, referencedColumnName = "corp_id")
            public Company company;
    
            public Company getCompany() {
                return company;
            }
    
            public void setCompany(Company company) {
                this.company = company;
            }
        }
    
        @Entity
        public static class Company extends Model {
            @Column(length = 50, unique = true)
            public String corpId;
    
            public String getCorpId() {
                return corpId;
            }
    
            public void setCorpId(String corpId) {
                this.corpId = corpId;
            }
        }
    }
    

    console:

    javax.persistence.PersistenceException: Error loading on EbeanTest$RoadShowMsg.company
    
        at com.avaje.ebeaninternal.server.query.SqlBeanLoad.load(SqlBeanLoad.java:85)
        at com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocOne.load(BeanPropertyAssocOne.java:615)
        at com.avaje.ebeaninternal.server.query.SqlTreeNodeBean.load(SqlTreeNodeBean.java:268)
        at com.avaje.ebeaninternal.server.query.CQuery.readNextBean(CQuery.java:431)
        at com.avaje.ebeaninternal.server.query.CQuery.hasNext(CQuery.java:512)
        at com.avaje.ebeaninternal.server.query.CQuery.readBean(CQuery.java:494)
        at com.avaje.ebeaninternal.server.query.CQueryEngine.find(CQueryEngine.java:356)
        at com.avaje.ebeaninternal.server.query.DefaultOrmQueryEngine.findId(DefaultOrmQueryEngine.java:129)
        at com.avaje.ebeaninternal.server.core.OrmQueryRequest.findId(OrmQueryRequest.java:251)
        at com.avaje.ebeaninternal.server.core.DefaultServer.findId(DefaultServer.java:1190)
        at com.avaje.ebeaninternal.server.core.DefaultServer.find(DefaultServer.java:1048)
        at com.avaje.ebeaninternal.server.core.DefaultServer.find(DefaultServer.java:1035)
        at EbeanTest.JsonTest(EbeanTest.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
        at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
    Caused by: org.h2.jdbc.JdbcSQLException: Data conversion error converting "corp_id_1000000" [22018-187]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
        at org.h2.message.DbException.get(DbException.java:168)
        at org.h2.value.Value.convertTo(Value.java:902)
        at org.h2.value.Value.getLong(Value.java:443)
        at org.h2.jdbc.JdbcResultSet.getLong(JdbcResultSet.java:650)
        at com.avaje.ebeaninternal.server.type.RsetDataReader.getLong(RsetDataReader.java:121)
        at com.avaje.ebeaninternal.server.type.ScalarTypeLong.read(ScalarTypeLong.java:34)
        at com.avaje.ebeaninternal.server.type.ScalarTypeLong.read(ScalarTypeLong.java:17)
        at com.avaje.ebeaninternal.server.deploy.BeanProperty.read(BeanProperty.java:581)
        at com.avaje.ebeaninternal.server.deploy.id.IdBinderSimple.read(IdBinderSimple.java:177)
        at com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocOne$Reference.read(BeanPropertyAssocOne.java:749)
        at com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocOne.read(BeanPropertyAssocOne.java:574)
        at com.avaje.ebeaninternal.server.query.SqlBeanLoad.load(SqlBeanLoad.java:74)
        ... 34 more
    Caused by: java.lang.NumberFormatException: For input string: "corp_id_1000000"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Long.parseLong(Long.java:589)
        at java.lang.Long.parseLong(Long.java:631)
        at org.h2.value.Value.convertTo(Value.java:854)
        ... 44 more
    
    bug 
    opened by icode 17
  • Context.toList error for Jackson module

    Context.toList error for Jackson module

    com.avaje.ebeaninternal.server.deploy.BeanDescriptorJsonHelp event != JsonToken.START_ARRAY is error

    public <T> List<T> toList(Class<T> cls, JsonParser src) throws JsonIOException {
            try {
                BeanDescriptor e = this.getDescriptor(cls);
                ArrayList list = new ArrayList();
                JsonToken event = src.nextToken();
                // this is a START_OBJECT
                if(event != JsonToken.START_ARRAY) {
                    throw new JsonParseException("Expecting start_array event but got " + event, src.getCurrentLocation());
                } else {
                    while(true) {
                        Object bean = e.jsonRead(src, (String)null);
                        if(bean == null) {
                            return list;
                        }
    
                        list.add(bean);
                    }
                }
            } catch (IOException var7) {
                throw new JsonIOException(var7);
            }
        }
    
    bug 
    opened by icode 17
  • DDL generation of DbEnumValue uses different strategies for different table

    DDL generation of DbEnumValue uses different strategies for different table

    Expected behavior

    Ebean should use same strategy when generating DDL for DbEnumValue i.e. either use Integer or VarChar, or should honour storage = DbEnumType.VARCHARwhen defined

    Actual behavior

    In my project it is using Integer for some table and VarChar for others even though I have defined storage = DbEnumType.VARCHAR on all enums.

    Steps to reproduce

    For below enum, ebean uses VarChar

     import io.ebean.annotation.DbEnumType;
    import io.ebean.annotation.DbEnumValue;
    
    
    public enum DeviceOTPTypeEnum {
    VALID("VALID"),
    VERIFIED("VERIFIED"),
    EXPIRED("EXPIRED");
    
    String value;
    
    DeviceOTPTypeEnum(String pValue){
    value=pValue;
    }
    
    
    @DbEnumValue(storage = DbEnumType.VARCHAR)
    public String getValue() {
    return value;
    }
    }
    

    DDL generated create table device_otp ( id uuid not null, otp integer not null, verified boolean default false not null, last_sent timestamptz, retry_count integer not null, device_id uuid not null, verified_at timestamptz, version bigint not null, when_created timestamptz not null, last_modified timestamptz not null, deleted boolean default false not null, generated_at timestamptz not null, otp_status varchar(8), constraint ck_device_otp_otp_status check ( otp_status in ('VALID','VERIFIED','EXPIRED')), constraint pk_device_otp primary key (id) );

    For below ENUM ebean uses Integer

     import io.ebean.annotation.DbEnumType;
    import io.ebean.annotation.DbEnumValue;
    
    public enum UserConsentType {
    
    SMS("SMS"),
    EMAIL("EMAIL"),
    WHATSAPP("WHATSAPP"),
    TERMS_AND_CONDITIONS("TERMS_AND_CONDITIONS"),
    CREDIT_REPORT("CREDIT_REPORT");
    
    String value;
    
    UserConsentType(String pValue){
    value=pValue;
    }
    
    @DbEnumValue(storage = DbEnumType.VARCHAR)
    String getValue(){
    return value;
    }
    }
    

    DDL generated create table device_consents ( id uuid not null, consent_type integer not null, device_id uuid not null, provided boolean default false not null, version bigint not null, when_created timestamptz not null, last_modified timestamptz not null, deleted boolean default false not null, constraint ck_device_consents_consent_type check ( consent_type in (0,1,2,3,4)), constraint pk_device_consents primary key (id) );

    opened by parveenyadav-multiply 0
  • Support jakarta.persistence.Entity?

    Support jakarta.persistence.Entity?

    I create a gradle project with SpringBoot 3.x, I find ebean only scan javax.persistence.Entity,not scan jakarta.persistence.Entity. When I use jakarta.persistence.Entity, DbMigration will say no changes detected, and querybean will not generate this QXXXEntity. source code: https://github.com/luoxiaopeng/test_ebean.git

    Is this right?

    opened by luoxiaopeng 2
  • @Entity and @Column seem not working while findNative by aggregate sql

    @Entity and @Column seem not working while findNative by aggregate sql

    Expected behavior

    query some object by annotation-driven mapping, have result object with properties populated.

    Actual behavior

    The result is like:

    leadsWebActionDataCountAggregates: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]
    

    Steps to reproduce

    we are using ebean to mapped result from clickhouse:

    the sql is like:

    select
      effective_action_type,
      CAST(min_action_time2 AS DATE) as effective_action_time,
      count(*) as action_count
    from
      (
        select
          effective_action_type,
          sign_id,
          min(action_time2) as min_action_time2
        from
          (
            select
              sign_id,
              action_time2,
              CASE
                WHEN final_action_type = 'wx_1166' THEN '405'
                ELSE final_action_type
              END AS effective_action_type
            from
              leads_web_action_data
            where
              action_time2 between '2022-12-13 00:00:00' and '2022-12-27 23:59:59'
            order by
              action_time2 desc
          )
        group by
          effective_action_type,
          sign_id
      )
    group by
      effective_action_type,
      CAST(min_action_time2 AS DATE)
    

    and the java bean is like:

    @Entity
    @Data
    public class LeadsWebActionDataCountAggregate {
    
        @Column(name = "effective_action_time")
        private Date effectiveActionTime;
    
        @Column(name = "effective_action_type")
        private Long effectiveActionType;
    
        @Column(name = "action_count")
        private Integer count;
    }
    

    the api invocation is like:

            Query<LeadsWebActionDataCountAggregate> basicQuery =
                    getServer().findNative(LeadsWebActionDataCountAggregate.class,
                                    nativeSql)
                            .setParameter("actionTimeBegin", condition.getActionTimeBegin())
                            .setParameter("actionTimeEnd", condition.getActionTimeEnd());
            return basicQuery.findList();
    
    leadsWebActionDataCountAggregates: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]
    
    opened by magicliang 1
  • findStream() / findEach() memory leak

    findStream() / findEach() memory leak

    Expected behavior

    Query::findStream() and Query::findEach() are supposed to not cache any items in the persistence context.

    Actual behavior

    Items are being cached in the persistence context causing OutOfMemoryError after some time. I've done simple tests:

    //...
    myQuery.findStream().forEach(System.out::println);
    
    //...
    myQuery.findEach(System.out::println);
    

    Here is a memory snapshot from the profiler after about 20 sec of execution: image

    P.S. I use Postgresql DB.

    opened by serg1236 4
  • BeanCache findMap in combination with findOne does not work.

    BeanCache findMap in combination with findOne does not work.

    Actual behavior

    It seems that certain combinations with findMaps and findOnes are not properly handled by the bean cache. (findList seems to work) See the minimal example:

    Steps to reproduce

      public void idsInFindMap() {
        List<OCachedBean> beans = createBeans(Arrays.asList("m0", "m1", "m2", "m3", "m4", "m5", "m6"));
        List<Long> ids = beans.stream().map(OCachedBean::getId).collect(Collectors.toList());
        beanCache.clear();
        beanCache.statistics(true);
        Query<OCachedBean> query = DB.find(OCachedBean.class).setUseCache(true);
        query.copy()
          .where().idIn(ids.subList(0, 1))
          .findMap(); // or findOne - it is important, that one entry is returned here
    
        query.copy()
          .where().idIn(ids.subList(0, 3))
          .findMap();
    
        query.copy()
          .where().idIn(ids.subList(2, 7))
          .findMap();
      }
    
    javax.persistence.PersistenceException: Error with property:3 dt:-5 data:6 java.lang.Long
    
    	at io.ebeaninternal.server.persist.Binder.bindSimpleData(Binder.java:341)
    	at io.ebeaninternal.server.persist.Binder.bindObject(Binder.java:234)
    	at io.ebeaninternal.server.persist.Binder.lambda$bindObject$0(Binder.java:179)
    	at io.ebeaninternal.server.persist.platform.MultiValueBind.bindMultiValues(MultiValueBind.java:50)
    	at io.ebeaninternal.server.persist.Binder.bindObject(Binder.java:179)
    	at io.ebeaninternal.server.expression.DefaultExpressionRequest.bind(DefaultExpressionRequest.java:62)
    	at io.ebeaninternal.server.query.CQueryPredicates.bind(CQueryPredicates.java:139)
    	at io.ebeaninternal.server.query.CQuery.prepareResultSet(CQuery.java:329)
    	at io.ebeaninternal.server.query.CQuery.prepareBindExecuteQueryWithOption(CQuery.java:290)
    	at io.ebeaninternal.server.query.CQuery.prepareBindExecuteQuery(CQuery.java:286)
    	at io.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:344)
    	at io.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:123)
    	at io.ebeaninternal.server.core.OrmQueryRequest.findMap(OrmQueryRequest.java:432)
    	at io.ebeaninternal.server.core.DefaultServer.findMap(DefaultServer.java:1130)
    	at io.ebeaninternal.server.querydefn.DefaultOrmQuery.findMap(DefaultOrmQuery.java:1495)
    	at io.ebeaninternal.server.expression.DefaultExpressionList.findMap(DefaultExpressionList.java:457)
    	at org.tests.cache.TestBeanCache.idsInFindMap(TestBeanCache.java:76)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
    	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
    	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
    	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
    	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
    	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
    	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
    	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
    	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
    	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
    	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
    	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
    	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
    	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
    	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
    	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
    	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
    	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
    	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
    	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
    Caused by: org.h2.jdbc.JdbcSQLDataException: Unerlaubter Wert "3" für Parameter "parameterIndex"
    Invalid value "3" for parameter "parameterIndex" [90008-214]
    	at org.h2.message.DbException.getJdbcSQLException(DbException.java:646)
    	at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
    	at org.h2.message.DbException.get(DbException.java:223)
    	at org.h2.message.DbException.getInvalidValueException(DbException.java:298)
    	at org.h2.jdbc.JdbcPreparedStatement.setParameter(JdbcPreparedStatement.java:1395)
    	at org.h2.jdbc.JdbcPreparedStatement.setLong(JdbcPreparedStatement.java:678)
    	at io.ebean.datasource.pool.ExtendedPreparedStatement.setLong(ExtendedPreparedStatement.java:223)
    	at io.ebeaninternal.server.bind.DataBind.setLong(DataBind.java:129)
    	at io.ebeaninternal.server.persist.Binder.bindSimpleData(Binder.java:271)
    	... 85 more
    
    opened by rPraml 0
  • `generator` param of `@GeneratedValue` is not ignored when using `GenerationType.AUTO` on db where this uses identity

    `generator` param of `@GeneratedValue` is not ignored when using `GenerationType.AUTO` on db where this uses identity

    Expected behavior

    When strategy = GenerationType.IDENTITY is used, the @SequenceGenerator annotation and the generator parameter of @GeneratedValue annotation is ignored, which is a good thing, because these don't actually make much sense when not using sequences. I think the behavior should be the same if you use strategy = GenerationType.AUTO on a db that chooses IDENTITY as the strategy.

    Actual behavior

    If you use GenerationType.AUTO on a db that chooses IDENTITY as the strategy (so basically any db except Oracle) the @SequenceGenerator annotation is correctly ignored, but the generator param of @GeneratedValue is not, resulting in the "No custom IdGenerator registered with name <specified generator name>" exception.

    Steps to reproduce

    Define an entity like this and use it in a db which chooses the IDENTITY strategy for GenerationType.AUTO

    @Entity
    @DbName("ea")
    @Table(name = "T_OBJECT")
    class EaObject(
        @Id
        @Column(name = "OBJECT_ID", nullable = false)
        @GeneratedValue(
            strategy = GenerationType.AUTO,
            generator = "t_object_sequence_generator"
        )
        @SequenceGenerator(
            name = "t_object_sequence_generator",
            sequenceName = "OBJECT_ID_SEQ",
        )
        var id: Long = 0,
    )
    
    Caused by: java.lang.RuntimeException: Error reading annotations for cz.sentica.qwazar.ea.core.entities.EaObject
    	at io.ebeaninternal.server.deploy.parse.ReadAnnotations.readInitial(ReadAnnotations.java:31)
    	at io.ebeaninternal.server.deploy.BeanDescriptorManager.createDeployBeanInfo(BeanDescriptorManager.java:1168)
    	at io.ebeaninternal.server.deploy.BeanDescriptorManager.readEntityDeploymentInitial(BeanDescriptorManager.java:641)
    	at io.ebeaninternal.server.deploy.BeanDescriptorManager.deploy(BeanDescriptorManager.java:290)
    	at io.ebeaninternal.server.core.InternalConfiguration.<init>(InternalConfiguration.java:129)
    	at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:104)
    	at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:29)
    	at io.ebean.DatabaseFactory.createInternal(DatabaseFactory.java:136)
    	at io.ebean.DatabaseFactory.create(DatabaseFactory.java:85)
    Caused by: java.lang.IllegalStateException: No custom IdGenerator registered with name t_object_sequence_generator
    	at io.ebeaninternal.server.deploy.parse.AnnotationFields.readGenValue(AnnotationFields.java:469)
    	at io.ebeaninternal.server.deploy.parse.AnnotationFields.initIdentity(AnnotationFields.java:162)
    	at io.ebeaninternal.server.deploy.parse.AnnotationFields.readField(AnnotationFields.java:136)
    	at io.ebeaninternal.server.deploy.parse.AnnotationFields.parse(AnnotationFields.java:62)
    	at io.ebeaninternal.server.deploy.parse.ReadAnnotations.readInitial(ReadAnnotations.java:29)
    	... 126 more
    
    opened by Incanus3 1
Releases(ebean-parent-13.11.0)
  • ebean-parent-13.11.0(Dec 8, 2022)

    reason-for-version-bump

    • #2907 - [DB2] Promote Db2SqlLimiter to be AnsiSqlRowsLimiter and move to ebean-api module

    What's Changed

    • #2903 #2904 - Fixed mandatory LIMIT generation in case of firstRow>0 by @serg1236
    • #2866 - FIX: @Formula / @Where Annotations should also match on base platform by @rPraml
    • #2914 - Query bean generation support for @ElementCollection with validaiton annotations - NPE NullPointerException
    • #2906 - Refactor tidy SqlLimiter implementations
    • #2909 - [Hana] Replace HanaSqlLimitSqlLimiter with standard LimitOffsetSqlLimiter

    New Contributors

    • @serg1236 made their first contribution in https://github.com/ebean-orm/ebean/pull/2904

    Full Changelog: https://github.com/ebean-orm/ebean/compare/ebean-parent-13.10.2...ebean-parent-13.11.0

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.10.2(Nov 21, 2022)

    Issues

    #2888 - DatabaseFactory.create() fails with java.lang.InstantiationError: io.ebean.bean.EntityBeanIntercept in multi-module gradle setup bug #2889 - test entities don't get enhanced after upgrade to 13.6.5 #2893 -fix(sec): upgrade com.fasterxml.jackson.core:jackson-databind to 2.14.0 #2887 - Bug: Setting isolation level disables query cache #2884 #2885 - Added platforms to BOM

    Enhancements

    #2894 - ENH: Lack of setNullParameter() functionality on io.ebean.DtoQuery interface #2864 - ENH: Override service objects with DatabaseConfig.putServiceObject

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.10.1(Nov 2, 2022)

    Issues

    #2880 - ADD encryption support for Between and InRange #2872 #2774 - Locally encrypted properties can be used in "in" queries #2861 - javax.persistence.PersistenceException: Database [null] was not found? when accessing OneToMany property bug #2862 - Ebean 13.9.3 : org.postgresql.util.PSQLException: Cannot rollback when autoCommit is enabled #2870 - FIX: Run CsvReaderTest also in german locale #2869 - FIX: Add fallback for Ebean 11 Jsons #2868 - FIX: toJsonNanos for calendar #2867 - FIX: Flush transaction if it is modified in callback #2863 - FIX: LogFormat for SystemLogger #2854 #2859 - Possible memory leak with BackgroundExecutor using BackgroundExecutorWrapper ThreadLocals (for scheduled tasks)

    Enhancements

    #2847 - Add support for Sub-query EQ, NE, LT, LE, GT, GE expressions enhancement #2875 - Query Beans: Add missing exists(subquery) and notExists(subquery) enhancement #2876 - Query Beans: Add eq() e.g .billingAddress.city.eq(QCustomer.Alias.shippingAddress.city) enhancement #2877 - Query Beans: Add lt, le, gt, ge e.g. whenRegistered.gt(QCustomer.Alias.whenActivated) enhancement #2873 - Query Beans: Support more TQProperty's as target value for inRangeWith() enhancement

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.10.0(Oct 14, 2022)

    reason-for-version-bump

    #2828 - Extract ebean-jackson-mapper module #2826 - Extract ebean-jackson-jsonnode module - support for Jackson JsonNode (into separate module) #2858 - ENH: Add experimental entity-field-access ... entities with public fields (no getters/setters/accessors required) enhancement #2855 - @DbArray not allowing null to be persisted, stores empty list instead bug reason-for-version-bump

    Issues

    #2856 - @DbArray - improve bind logging, non-null arrays auto bind null to [] so improve bind logging to reflect that #2857 - @DbArray - slight performance optimisation for empty array

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.9.3(Sep 13, 2022)

    Issues

    #2833 - Fix PostgresPlatformProvider plaform sniffing query (Postgres vs Cockroach) #2825 - DB Migration - create schema migration is repeated unnecessarily

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.9.2(Sep 5, 2022)

    Issues

    #2823 #2824 - Revert JdbcTransaction.isActive() back to be non-final method #2822 - FIX: DB2 migration: call reorg after drop not null #2821 - Minor dependency bump for jackson, assertj-core, joda-time, h2database

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.9.1(Sep 1, 2022)

    Bugs

    #2818 #2820 - Concurrent modification of listenerNotify list bug #2814 #2815 - setNestedUseSavepoint act globally and not only for the current transaction level bug

    Enhancements

    #2819 - ENH: Add Transaction.rollbackAndContinue()

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.9.0(Sep 1, 2022)

    Major bug

    #2813 #2816 - Sometimes subquery use wrong alias in SQL

    reason-for-version-bump

    #2457 #2810 - Move Joda time support into separate optional ebean-joda-time module When using Joda time types please check the classpath to ensure that it contains the ebean-joda-time dependency.

    <dependency>
      <groupId>io.ebean</groupId>
      <artifactId>ebean-joda-time</artifactId>
      <version>13.9.0</version>
    </dependency>
    

    #2805 - [breaking-api] Extract csv reader into it's own ebean-csv-reader module When using the CsvReader please check the classpath to ensure that it contains the ebean-csv-reader dependency and look at the details of the change in #2805.

    <dependency>
      <groupId>io.ebean</groupId>
      <artifactId>ebean-csv-reader</artifactId>
      <version>13.9.0</version>
    </dependency>
    

    #2801 - Remove the OnQueryOnly (rollback) feature #2800 - Refactor database platform - remove unused tableExists() method, rename getters to accessors

    Refactoring

    #2812 - IntelliJ inspect various improvements #2811 - Refactor method names SpiJsonReader and DocStore types #2809 - Refactor move BasicTypeConverter to ebean-core-type module #2808 - Refactor move package - server.type.DataBind to server.bind, server.text.json -> server.json #2807 - Refactor move ScalarTypeBaseDate, ScalarTypeBaseDateTime, ScalarTypeBaseVarchar to ebean-core-type module #2806 - Refactor ScalarType, remove convertFromMillis() method (no longer needed) #2804 - Refactor move ScalarTypeBase + remove loadIgnore() #2803 - Refactor ScalarType methods from getters to accessors #2802 - Remove ScalarType.isDateTimeCapable() ... (only used by CSV reader)

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.8.1(Aug 24, 2022)

    Issues

    #2799 - Remove unused DatabasePlatform.treatEmptyStringsAsNull #2798 - SQL Anywhere: invalid escape character on like expression #2649 #2797 - Migrate Ebean to use of JDK System.Logger (make SLF4J-API an optional dependency) #2796 - Add missing final modifier on methods of query bean types

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.8.0(Aug 18, 2022)

    reason-for-version-bump

    #2787 - Revert "Migrate to Jakarta JAXB (jakarta.xml.bind <- javax.xml.bind)" dependencies

    Issues

    #2782 #2783 #2793 - Support MariaDB driver 3.x - Illegal fetch size, batched jdbc exception translation, SqlRow blob reading bug #2788 - Unable to map _float4 Postgres type to @DbArray List Java type

    #2784 #2785 - Correct documentation for TQRootBean.findSingleAttribute with @Nullable #2786 - ebean version unknown. When running the springboot packaged application #2794 - ebean-test-containers - Handle SQLServer specific occasional fail on start #2791 - Refactor Just use String.intern() now that we are on min Java 11 runtime. #2795 - Refactor rename internal methods - io.ebeaninternal.server.query #2779 - Refactor rename internal methods for SpiQueryPlan and DbReadContext

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.7.0(Aug 9, 2022)

    reason-for-version-bump

    #2722 - Migrate to Jakarta JAXB (jakarta.xml.bind <- javax.xml.bind)

    Issues

    #2770 - Add SqlQuery usingTransaction() for consistency and deprecate ExtendedServer API #2772 - Add ebean-annotation to BOM #2766 #2767 - Reference bean created from JSON can invoke lazy loading by default (didn't prior to 12.13.1) #2762 #2765 - NullPointerException while using findCount with forUpdate bug #2733 #2745 - Rename ModuleInfoLoader to EntityClassRegister and _Ebean$ModuleInfo to EbeanEntityRegister

    Enhancements

    #2778 - Support a naming convention function that can be applied to metrics names for reporting

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.6.6(Aug 1, 2022)

    Bugs

    #2753 #2754 #2755 #2756 #2746 - Bugs findSingleAttributeList projecting a OneToMany property #2763 - Fix: toJson must use setIntercept if target bean is passed #2750 - Stateless update populates OneToMany with softdeleted records during serializing #2748 - Second fetch inside transaction doubles the fetched @OneToMany rows when .setLoadBeanCache(false) #2742 - ModelContainer.applyChangeSet(ModelContainer.java:167) - IllegalArgumentException: No rule for #2764 - Fix: DDL will get wrong hint for special migration

    Enhancements

    #2757 - Add notIn(Query) to query beans #2768 - ENH: Add eqIfPresent() - a helper expression for fluid style when some EQ are optional enhancement #2760 - Add ServerMetrics.asJson() ... to support conversion of collected metrics to json #2749 - Bump ebean-datasource, ebean-annotation, ebean-types, persistence-api #2743 - Postgres DDL - For create table, improve column ordering for tighter storage

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.6.5(Jul 6, 2022)

    Issues

    #2730 - Secondary @OneToMany fetch query is not happening if the same Entity type is fetched #2737 - Mapping of TimeZone doesn't have enough characters #2727 - Stateless update on one-to-many relationship with children soft delete results in a hard delete instead of only inserting new child bug

    #2741 - Bump avaje-config to 2.1 and modify ebean-test to support use of ${docker.host} in test container jdbc urls #2734 - maven build - exluding maven descriptor (pom and properties) from built artifacts #2732 - ebean-agent - skip transactional profiling aware enhancement on query beans #2731 - Change ebean-querybean annotations from Retention RUNTIME to CLASS refactor #2723 - Gradle plugin enhancement with Kotlin 1.7.0 bug #2740 - Bump ebean-test-containers to 6.2

    Enhancements

    #2736 - ENH: findDto nonsupport setter chain (accessor style setters, both fluid style and non fluid style)

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.6.4(Jun 14, 2022)

    Issues

    #2719 - DDL - Refactor DDL for Postgres and YugabyteDB to just create a default partition table #2718 - [Yugabyte] Fix such that builtin table partition functions are included in DDL (when we use table partitioning) bug #2717 - Support Postgres JSONB/JSON with String - @DbJsonb String content; #2716 - Refactor ScalarType interface to make use of default methods refactor #2715 - [ebean-test-containers] Fix for Postgis to support extraDb (second database), Update Oracle container #2713 - Improve javadoc of Finder, BeanFinder, BeanRepository - deprecate use of BeanFinder server field (migrate to database) #2712 - Bump jedis to 4.2.3 (from 4.2.2) dependencies #2711 - Gradle: Change querybean generator from isolating to aggregating #2710 - JSONB fields are not considered dirty after modified in BeanPersistController preUpdate bug #2708 - Part 1: Fix read/write/query LocalTime values (when time zone configured to be used) #2706 - ENH: Add support for findSingleAttributeSet()

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.6.3(May 24, 2022)

    Issues

    #2704 #2702 - IllegalArgumentException: No rule for io.ebeaninternal.dbmigration.migration.RenameTable #2703 - ebean-test-docker was renamed to ebean-test-containers #2701 - [DDL] Postgres DDL generation for table partitioning with schema - helper method to add partitions does not work bug

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.6.2(May 18, 2022)

    Issues

    #2697 - Postgres DDL - With Postgres table partitioning, add partition column to primary key #2695 - DDL Generation for @UniqueConstraint ignores the name - should be the index name when given #2694 - Postgres DDL - For Postgres table partitioning, remove the "suppressPrimaryKeyOnPartition" mode #2693 - DDL - Add support for creating schema via database migrations (and create all ddl) #2692 - [querybean generation] Compile error, incorrect generation with nested inner class/record @Embeddable and @IdClass

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.6.1(May 16, 2022)

    Issues:

    #2690 - Bug - OneToMany orphanRemoval = true, replace collection adding back … #2687 - Annoying message while using OpenTelemetry: msg: defaulted common supertype for type <...> due to err:java.lang.IllegalStateException: ClassLoader is null? #2691 - Improve logging summary when insert bean with no @Id ...

    ebean-test-docker

    #2688 #2685 - Bump to ebean-test-docker 5.3 with newBuilder() -> builder() with deprecation dependencies #2686 - [ebean-test] Allow docker configuration options to be at ebean.test.X as well as ebean.test..X

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.6.0(May 3, 2022)

    Change - optimise readOnly + disableLazyLoading

    #2626 - Support EntityBeanIntercept as an interface with InterceptReadWrite and InterceptReadOnly options

    Remove deprecated API

    #2662 - Remove deprecated Ebean, EbeanServer, EbeanServerFactory, ServerConfig migrate to DB, Database, DatabaseFactory, DatabaseConfig

    Use System.Logger rather than slf4j-api

    #2650 - Bump ebean-ddl-runner (sync version with ebean-migration) #2648 - Bump avaje classpath scanner to 7.1, ignores module-info, uses System.Logger (not slf4j-api) #2683 - Bump ebean-datasource to 8.0 with use of System.Logger (from slf4j-api) #2682 - Bump ebean-migration to 13.6.0 (bumps classpath scanner and ebean-ddl-runner)

    Issues

    #2681 #2647 - When Postgres + isAllQuotedIdentifiers true + using DataSourceConfig THEN datasourceConfig.addProperty("quoteReturningIdentifiers", false); #2680 - Add documentation how to release Ebean in own (non nexus) repository with maven-deploy-plugin #2677 #2679 - Fix for trim failing on mutation of lastAccessTime #2675 - Modify DefaultOrmQuery to have non-final copy() methods to allow ebean-mocker to be updated #2674 - Bump to ebean-test-docker 5.0 #2647 - RETURNING column name is quoted excessively #2653 - Developing in eclipse becomes a pain documentation

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.5.0(Apr 28, 2022)

    Reason-for-version-bump

    #2672 - [ebean-agent] ToStringBuilder enhancement does not use toString() of the abstract class bug

    Issues

    #2673 - Bug introduced in 13.3.1 via #2652 - incorrect binding of history query with SQL2011 standards based queries bug regression #2671 - Bump ebean-test-docker to 4.7

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.4.1(Apr 26, 2022)

    Issues

    #2670 - Missing implementation of loadIgnore in ScalarTypePgisBase #2669 - FIX: StackOverflowException when using recursive relation within Map

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.4.0(Apr 21, 2022)

    Issues

    #2655 - Remove JndiDataSourceLookup - app perform JNDI lookup if needed behaviour change #2666 - Fix: CompareTo when discriminatorString is null #2665 - NodeUsageCollector migrate from using finalize() to Cleaner #2667 - Bump jedis dependency to 4.2.2 from 4.2.1

    Remove deprecated methods

    #2661 - from BackgroundExecutor, migrate executePeriodically() -> scheduleWithFixedDelay() #2660 - from BeanPersistRequest, BeanQueryRequest, BeanDeleteIdRequest #2659 - from Transaction, migrate setBatchGetGeneratedKeys() -> setGetGeneratedKeys() etc #2658 - from SpiServer, migrate getServerConfig() -> config() etc #2657 - from FetchConfig, migrate new FetchConfig().query(50) -> FetchConfig.ofQuery(50) #2656 - rom Pairs, migrate setConcatSeparator() -> concatSeparator()

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.3.1(Apr 20, 2022)

    Issues:

    #2652 #2651 - @OneToOne with @History produces incorrect query #2654 - Fix: Setting file with same content should not make bean dirty #2646 - Produce deterministic DDL if @Inheritance is used #2645 - NPE executing query with beanCache order by & clear

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.3.0(Apr 12, 2022)

    Issues

    #2641 #2642 - Provide a decent default toString() implementation for entity beans #2644 - ebean-test - Fix AutoConfigureForTesting to skip configuration for non-default DatabaseConfig

    dependencies

    #2640 - ebean-redis - bump jedis dependency to 4.2.1 from 4.2.0 #2643 - Bump dependencies h2database -> 2.1.212 ebean-test-docker -> 4.6

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.2.0(Apr 7, 2022)

    Issues

    • #2638 - Refactor L2 cache tenant awareness - add TenantAwareCache

    deprecated-api removed

    • #2636 #2637 - Remove deprecated @CreatedTimestamp and @UpdateTimestamp, migrate to @WhenCreated / @WhenModified
    • #2634 - In ebean-api - DB
    • #2635 - In ebean-api - Database
    • #2639 - On ServerCache getHitRatio() -> hitRatio(), getStatistics() -> statistics()
    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.1.0(Apr 6, 2022)

    Issues:

    #2624 #2623 - CurrentTenantProvider called even when table has no tenantId column specified bug #2627 - ebean-agent - bump to ASM 9.3, support Java 19 bytecode

    deprecated-api removed

    #2633 - Remove deprecated methods in ebean-api - BeanState #2632 - Remove deprecated methods in ebean-api - SqlUpdate #2631 - Remove deprecated methods in ebean-api - SqlQuery #2630 - Remove deprecated methods in ebean-api - ServerCacheManager ServerCacheRegion #2629 - Remove deprecated methods from ebean-api meta metric and plugin packages #2628 - Remove deprecated findLargeStream(), migrate to findStream()

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-13.0.0(Mar 31, 2022)

    Java 11

    1) Java 11

    #2622 #2374 - Bump to Java 11 and move module-info (no longer multi-release jars)

    2) Separate modules per platform

    #2614 #2621 - Refactor extract separate modules for each platform from ebean-api dbplatform

    There are now platform specific modules like ebean-postgres, ebean-mysql, ebean-sqlserver etc. The dependency io.ebean : ebean is a composite that includes all the platforms. From Ebean 13 onwards applications that only target one or a few platforms can instead depend on those specific modules instead.

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-12.16.1(Mar 29, 2022)

    Issues

    #2619 - Lack of setNullParameter() functionality on io.ebean.SqlQuery interface #2617 - ENH: JsonContext accepts a bean as target #2613 - Bump ebean-migration to 12.16.1 bug #2609 - Fix module-info export io.ebean.config.dbplatform.yugabyte bug #2600 - Pending drops migration with the same version of the target migration cause trouble bug

    DDL

    #2612 - Incorrect DDL generation for MySql on history tables that use quoted identifiers bug #2537 #2608 - DB2: Add Tablespace support #2607 - DDL: Support schema in history entities and ignore case in DB2 procedures #2605 - DB2-DDL: Create history table with "create table as" #2606 - Use correctly quoted historyTableName in DDL-History #2604 - Remove LowerTableName #2603 - Refactored DDL generation to correctly handle quoted identifiers #2601 - Extended @Column support for DB2

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-12.16.0(Mar 16, 2022)

    reason-for-version-bump

    #2584 - Small code change for Hazelcast 4.1.5 #2594 - [DDL-Refactor] History table generation #2587 - [Ddl refactor] Alter Table changes are grouped by table name.

    Regression fixes

    #2581 - Softdelete on @OneToMany is ignored after refresh() (since 12.11.5) bug regression #2583 - Fix for regression, BackgroundExecutor is bounded (since 12.6.2) #2582 - Behaviour change: Backgroundexecutor is bounded (since 12.6.2) bug regression

    Issues

    #2598 - H2 + @Lob String fails with - Error[Value too long for column "CHARACTER VARYING": "... (1048577)" [22001-210]] bug #2556 - DB2 reorg table support #2596 - DDl-Refactor: Add DB2 Reorg support and history support #2595 - NPE by lazy loading a cached bean #2593 - Tidy SqlTreeBuilder to not add duplicate BeanProperties bug #2575 - [DDL-ClickHouse] fixes for ClickHouse platform #2580 - Bug: Wrong join in query with @Inheritance and @DbForeignKey #2590 - Provide custom BackgroundExecutorWrapper to pass thread locals #2591 - [DDL-refactor] Sorted the statements, so that they are going to the correct buffers #2589 - No effective DDL change - refactor whitespace and add buffer comments

    #2588 - [postgis-jdbc] Bump postgis-jdbc dependency from 2.2.1 to 2.5.1 dependencies #2586 - [Clickhouse] Refactored columnNotNull #2585 - Fix DDL Default handling & Prepared PlatformDdl to to have only one 'alterColumn' method #2578 - Bump to ebean-ddl-runner 1.3 #2579 - Bump to ebean-migration 12.16.0, support both basePlatform and platform for finding/running migrations reason-for-version-bump

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-12.15.1(Mar 1, 2022)

    Issues:

    #2577 - Refactor internals remove no longer needed DdlAutoCommit platform option refactor #2576 - [H2] Change H2HistoryTrigger to use microsecond precision bug #2574 - [DDL-Cockroach] Fixes for Cockroach platform #2573 - [DDL-hana] HANA always requires stored procedures #2571 - [DDL-SqLite] Modified SqLite platform to generate at least non failing migration scripts #2570 - [DDL-Oracle] Fix drop default and ignore erros when trying to drop non existent objects #2569 - [DDL-common] Extended DbMigrationTest to run on all platforms #2568 - Removed unused imports and add missing Override statements (no effective code change) #2567 - Tidy up ddl generation (no effective code change) #2559 - ENH: Support different ColumnDefinition for different database platforms enhancement #2557 - Refactored DDL generation #2563 - ENH: Different ColumnDefinition for different platforms #2558 - Bug: save with cascade of @OneToOne + @Version model sets version to 1 #2551 - Move DbMigration-Tests to ebean-test #2555 - ClickHouseDb - decimal[] array type missing #2554 - generate mysql StoredProcs for column deletion also for mariadb #2553 - Add Yugabyte-Platform to DefaultDbMigration #2552 - DTimedMetricTest fails sometimes (flaky test) #2549 - Fix DefaultPersister to expose non RuntimeExceptions on insert/update/delete. Not hide NoClassDefFoundError etc bug #2550 - CockroachDB - Now supports LIKE ESCAPE and no longer needs Autocommit for DDL #2547 - CockroachDB identity DDL - Changing to use standard GENERATED ... AS IDENTITY syntax #2548 - CockroachDB - Modify tests, use BigDecimal over Double etc

    Source code(tar.gz)
    Source code(zip)
  • ebean-parent-12.15.0(Feb 2, 2022)

    Reason for version bump

    #2501 - Bump h2database to v2.1.x from 1.4.199 with associated H2Platform changes #2512 - ADD: different DB2 platforms, Split DBPlatform into multiple platforms reason-for-version-bump #2509 - Support jedis 4.1.0 client (ScanParams, ScanResult in different package now),

    H2 Database

    #2501 - Bump h2database to v2.1.x from 1.4.199 with associated H2Platform changes

    DB2 support

    #2512 - ADD: different DB2 platforms #2506, #2533, #2534, #2535, #2545, #2546, #2518, #2519, #2520, #2523, #2524, #2525, #2526, #2527, #2528, #2522, #2514, #2532, #2521, #2531

    Yugabyte support

    #2516 - Yugabyte platform support - Automatic detection and DDL support #2529, #2546, #2545, #2535, #2534, #2533, #2529

    Other Issues

    #2494 - Optionally allow use of stored procedures for MySql to drop columns in db migration #2403 - Reintroduce stored procedures to drop columns on MySql #2500 - Refactor internals split result load functionality from SqlTreeNode into SqlTreeLoad #2502 - Fix: composite id in select distinct queries #2504 - Cannot delete bean with more than 2100 child beans on SqlServer #2505 - Refactor UUID generator. Add uuid-property to serverConfig (#57) #2508 - Bump ebean-datasource to 7.5 #2515 - Add maxInBinding - Oracle support for large delete by ids #2511 - Unselect LOBs when making a distinct select #2517 - FIX: Datasource was not initialized in offline mode. #2536 - ebean-test - bump Postgres default container to 14 #2538 - Performance - cache the path maps used for load context #2507 - Script runner does not work with file system path enhancement #2415 - SQL for Index and Foreign Key didn't get generated if I map ID column after @ManyToOne bug #2544 - Support @DbArray of BigDecimal #2530 - H2 Array Support seems incomplete (h2database 1.x -> 2.x upgrade)

    Source code(tar.gz)
    Source code(zip)
Android ORM

Shillelagh Shillelagh is an sqlite library. It was built to make life easier. The entire library was built around simplicity when using sqlite in Andr

Andrew Reitz 49 Sep 11, 2020
Compile-time active record ORM for Android

Ollie Compile-time active record ORM for Android. Multiple mapping methods. SQLiteDatabase-like interface (QueryUtils.java). Lightweight query builder

Michael Pardo 423 Dec 30, 2022
a 3d database ORM experiment. (used in two commercial projects)

Android-TriOrm a 3d database ORM experiment for Android. (used in two commercial projects). based around small tables concept and JVM Serialization. H

Tomer Shalev 19 Nov 24, 2021
A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

README DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to gener

Andrew Grosner 4.9k Dec 30, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022
ORMDroid is a simple ORM persistence framework for your Android applications.

ORMDroid is a simple ORM persistence framework for your Android applications, providing an easy to use, almost-zero-config way to handle model persist

Ross Bamford 87 Nov 10, 2022
AndroidQuery is an Android ORM for SQLite and ContentProvider which focuses on easy of use and performances thanks to annotation processing and code generation

WARNING: now that Room is out, I no longer maintain that library. If you need a library to easy access to default android ContentProvider, I would may

Frédéric Julian 19 Dec 11, 2021
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022
An ORM for Android with type-safety and painless smart migrations

Android Orma Orma is a ORM (Object-Relation Mapper) for Android SQLiteDatabase. Because it generates helper classes at compile time with annotation pr

The Maskarade project 440 Nov 25, 2022
Performance comparison of Android ORM Frameworks

Performance comparison of Android ORM Frameworks At the moment there are a lot of ORM-libraries for the Android OS. We reviewed the most popular ones

Alexey Zatsepin 328 Dec 21, 2022
JAKO: Just Another Kotlin Orm (PostgreSQL)

JAKO: Just Another Kotlin Orm (PostgreSQL) JAKO is a simple, minimal, no-dependency library to build and execute postgresql statements using a fluent

Alessio 6 May 27, 2022
greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.

Check out ObjectBox Check out our new mobile database ObjectBox (GitHub repo). ObjectBox is a superfast object-oriented database with strong relation

Markus Junginger 12.6k Jan 3, 2023
Android ORM

Shillelagh Shillelagh is an sqlite library. It was built to make life easier. The entire library was built around simplicity when using sqlite in Andr

Andrew Reitz 49 Sep 11, 2020
Compile-time active record ORM for Android

Ollie Compile-time active record ORM for Android. Multiple mapping methods. SQLiteDatabase-like interface (QueryUtils.java). Lightweight query builder

Michael Pardo 423 Dec 30, 2022
a 3d database ORM experiment. (used in two commercial projects)

Android-TriOrm a 3d database ORM experiment for Android. (used in two commercial projects). based around small tables concept and JVM Serialization. H

Tomer Shalev 19 Nov 24, 2021
A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

README DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to gener

Andrew Grosner 4.9k Dec 30, 2022
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
droidparts 6.7 0.0 L5 Java DI, ORM, JSON, ...

DroidParts a carefully crafted Android framework that includes: DI - injection of Views, Fragments, Services, etc. ORM - efficient persistence utilizi

DroidParts 779 Dec 21, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022