I - The ID typeT - The Bean typepublic abstract class BeanFinder<I,T> extends Object
Note that typically users would extend BeanRepository rather than BeanFinder.
public class CustomerFinder extends BeanFinder<Long,Customer> {
  @Inject
  public CustomerFinder(EbeanServer server) {
    super(Customer.class, server);
  }
  // ... add customer specific finders
}
| Modifier and Type | Method and Description | 
|---|---|
Transaction | 
currentTransaction()
Return the current transaction. 
 | 
EbeanServer | 
db()
Return the EbeanServer to use. 
 | 
EbeanServer | 
db(String server)
Return typically a different EbeanServer to the default. 
 | 
void | 
deleteById(I id)
Delete a bean by Id. 
 | 
List<T> | 
findAll()
Retrieves all entities of the given type. 
 | 
T | 
findById(I id)
Retrieves an entity by ID. 
 | 
Optional<T> | 
findByIdOrEmpty(I id)
Find an entity by ID returning an Optional. 
 | 
void | 
flush()
Flush the JDBC batch on the current transaction. 
 | 
T | 
ref(I id)
Creates an entity reference for this ID. 
 | 
public EbeanServer db()
public Transaction currentTransaction()
public void flush()
public EbeanServer db(String server)
This is equivalent to Ebean.getServer(String)
server - The name of the EbeanServer. If this is null then the default EbeanServer is
              returned.@Nonnull public T ref(I id)
Equivalent to Database.getReference(Class, Object)
@Nullable public T findById(I id)
Equivalent to Database.find(Class, Object)
@Nullable public Optional<T> findByIdOrEmpty(I id)
public void deleteById(I id)
Equivalent to Database.delete(Class, Object)
Copyright © 2019. All rights reserved.