Skip to content

Commit

Permalink
Merge remote-tracking branch 'ebean/master' into pr/enh/stored_proced…
Browse files Browse the repository at this point in the history
…ures_mysql_drop_column
  • Loading branch information
jonasPoehler committed Nov 26, 2021
2 parents b60f920 + 0a71ad6 commit c67e66c
Show file tree
Hide file tree
Showing 138 changed files with 1,757 additions and 1,366 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

name: Build

on: [push, pull_request]

jobs:
build:

runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
java_version: [8]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java_version }}
distribution: 'adopt'
- name: Maven cache
uses: actions/cache@v2
env:
cache-name: maven-cache
with:
path:
~/.m2
key: build-${{ env.cache-name }}
- name: Build with Maven
run: mvn package

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/ebean-orm/ebean.svg?branch=master)](https://travis-ci.org/ebean-orm/ebean)
[![Build](https://github.com/ebean-orm/ebean/actions/workflows/build.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/build.yml)
[![Maven Central : ebean](https://maven-badges.herokuapp.com/maven-central/io.ebean/ebean/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.ebean/ebean)

# Sponsors
Expand Down
7 changes: 3 additions & 4 deletions ebean-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.12.1-SNAPSHOT</version>
<version>12.13.2-SNAPSHOT</version>
</parent>

<name>ebean api</name>
Expand Down Expand Up @@ -36,9 +36,8 @@
-->
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsr305</artifactId>
<version>1.1</version>
<scope>provided</scope>
<artifactId>avaje-lang</artifactId>
<version>1.0</version>
</dependency>

<dependency>
Expand Down
3 changes: 3 additions & 0 deletions ebean-api/src/main/java/io/ebean/BackgroundExecutor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.ebean;

import io.avaje.lang.NonNullApi;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
Expand All @@ -18,6 +20,7 @@
* This also propagates MDC context from the current thread to the
* background task if defined.
*/
@NonNullApi
public interface BackgroundExecutor {

/**
Expand Down
9 changes: 3 additions & 6 deletions ebean-api/src/main/java/io/ebean/BeanFinder.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.ebean;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import java.util.List;
import java.util.Optional;

Expand All @@ -27,10 +27,10 @@
* @param <I> The ID type
* @param <T> The Bean type
*/
@NonNullApi
public abstract class BeanFinder<I,T> {

protected final Database server;

protected final Class<T> type;

/**
Expand Down Expand Up @@ -81,7 +81,6 @@ public Database db(String server) {
* <p>
* Equivalent to {@link Database#reference(Class, Object)}
*/
@Nonnull
public T ref(I id) {
return db().reference(type, id);
}
Expand All @@ -97,7 +96,6 @@ public T findById(I id) {
/**
* Find an entity by ID returning an Optional.
*/
@Nullable
public Optional<T> findByIdOrEmpty(I id) {
return db().find(type).setId(id).findOneOrEmpty();
}
Expand All @@ -112,7 +110,6 @@ public void deleteById(I id) {
/**
* Retrieves all entities of the given type.
*/
@Nonnull
public List<T> findAll() {
return query().findList();
}
Expand Down
2 changes: 2 additions & 0 deletions ebean-api/src/main/java/io/ebean/BeanRepository.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.ebean;

import io.avaje.lang.NonNullApi;
import io.ebean.bean.EntityBean;

import java.util.Collection;
Expand Down Expand Up @@ -31,6 +32,7 @@
* @param <I> The ID type
* @param <T> The Bean type
*/
@NonNullApi
public abstract class BeanRepository<I, T> extends BeanFinder<I, T> {

/**
Expand Down
2 changes: 0 additions & 2 deletions ebean-api/src/main/java/io/ebean/BeanState.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.ebean;

import javax.annotation.Nullable;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -138,7 +137,6 @@ default Map<String, ValuePair> getDirtyValues() {
/**
* Returns a map with load errors.
*/
@Nullable
Map<String, Exception> loadErrors();

/**
Expand Down
85 changes: 4 additions & 81 deletions ebean-api/src/main/java/io/ebean/DB.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.ebean;

import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import io.ebean.annotation.TxIsolation;
import io.ebean.cache.ServerCacheManager;
import io.ebean.plugin.Property;
import io.ebean.text.csv.CsvReader;
import io.ebean.text.json.JsonContext;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.persistence.OptimisticLockException;
import javax.persistence.PersistenceException;
import java.util.Collection;
Expand Down Expand Up @@ -60,6 +60,7 @@
*
* }</pre>
*/
@NonNullApi
public final class DB {

private static final DbContext context = DbContext.getInstance();
Expand Down Expand Up @@ -523,15 +524,13 @@ public static int saveAll(Object... beans) throws OptimisticLockException {
* @param bean The entity bean to check uniqueness on
* @return a set of Properties if constraint validation was detected or empty list.
*/
@Nonnull
public static Set<Property> checkUniqueness(Object bean) {
return getDefault().checkUniqueness(bean);
}

/**
* Same as {@link #checkUniqueness(Object)}. but with given transaction.
* Same as {@link #checkUniqueness(Object)} but with given transaction.
*/
@Nonnull
public static Set<Property> checkUniqueness(Object bean, Transaction transaction) {
return getDefault().checkUniqueness(bean, transaction);
}
Expand Down Expand Up @@ -851,15 +850,13 @@ public static CallableSql createCallableSql(String sql) {
* }</pre>
*/
public static <T> Update<T> createUpdate(Class<T> beanType, String ormUpdate) {

return getDefault().createUpdate(beanType, ormUpdate);
}

/**
* Create a CsvReader for a given beanType.
*/
public static <T> CsvReader<T> createCsvReader(Class<T> beanType) {

return getDefault().createCsvReader(beanType);
}

Expand Down Expand Up @@ -897,7 +894,6 @@ public static <T> Query<T> createNamedQuery(Class<T> beanType, String namedQuery
* @return A ORM Query for this beanType
*/
public static <T> Query<T> createQuery(Class<T> beanType) {

return getDefault().createQuery(beanType);
}

Expand Down Expand Up @@ -935,7 +931,6 @@ public static <T> Query<T> createQuery(Class<T> beanType) {
* @return The query with expressions defined as per the parsed query statement
*/
public static <T> Query<T> createQuery(Class<T> beanType, String eql) {

return getDefault().createQuery(beanType, eql);
}

Expand All @@ -951,7 +946,6 @@ public static <T> Query<T> createQuery(Class<T> beanType, String eql) {
* @return A ORM Query object for this beanType
*/
public static <T> Query<T> find(Class<T> beanType) {

return getDefault().find(beanType);
}

Expand Down Expand Up @@ -1030,77 +1024,6 @@ public static <T> Filter<T> filter(Class<T> beanType) {
return getDefault().filter(beanType);
}

// /**
// * Execute a Sql Update Delete or Insert statement. This returns the number of
// * rows that where updated, deleted or inserted. If is executed in batch then
// * this returns -1. You can get the actual rowCount after commit() from
// * updateSql.getRowCount().
// * <p>
// * If you wish to execute a Sql Select natively then you should use the
// * FindByNativeSql object.
// * </p>
// * <p>
// * Note that the table modification information is automatically deduced and
// * you do not need to call the DB.externalModification() method when you
// * use this method.
// * </p>
// * <p>
// * Example:
// * </p>
// * <pre>{@code
// *
// * // example that uses 'named' parameters
// * String s = "UPDATE f_topic set post_count = :count where id = :id"
// *
// * SqlUpdate update = DB.createSqlUpdate(s);
// *
// * update.setParameter("id", 1);
// * update.setParameter("count", 50);
// *
// * int modifiedCount = DB.execute(update);
// *
// * String msg = "There where " + modifiedCount + "rows updated";
// *
// * }</pre>
// *
// * @param sqlUpdate the update sql potentially with bind values
// * @return the number of rows updated or deleted. -1 if executed in batch.
// * @see SqlUpdate
// * @see CallableSql
// * @see DB#execute(CallableSql)
// */
// public static int execute(SqlUpdate sqlUpdate) {
// return defaultDatabase().execute(sqlUpdate);
// }
//
// /**
// * For making calls to stored procedures.
// * <p>
// * Example:
// * </p>
// * <pre>{@code
// *
// * String sql = "{call sp_order_modify(?,?,?)}";
// *
// * CallableSql cs = DB.createCallableSql(sql);
// * cs.setParameter(1, 27);
// * cs.setParameter(2, "SHIPPED");
// * cs.registerOut(3, Types.INTEGER);
// *
// * DB.execute(cs);
// *
// * // read the out parameter
// * Integer returnValue = (Integer) cs.getObject(3);
// *
// * }</pre>
// *
// * @see CallableSql
// * @see Ebean#execute(SqlUpdate)
// */
// public static int execute(CallableSql callableSql) {
// return defaultDatabase().execute(callableSql);
// }

/**
* Execute a TxRunnable in a Transaction with an explicit scope.
* <p>
Expand Down
Loading

0 comments on commit c67e66c

Please sign in to comment.