Index

A C D E F G I J M N O P R S T U V 
All Classes and Interfaces|All Packages|Serialized Form

A

add(Class<?>, String) - Method in class io.github.simplejdbcmapper.core.MultiEntity
Add entities for multi-entity processing.
addEntityResult(Class<T>, List<T>, String) - Method in class io.github.simplejdbcmapper.relationship.RelationshipMapper
Add an entity result
AnnotationException - Exception Class in io.github.simplejdbcmapper.exception
Annotation Exception.
AnnotationException(String) - Constructor for exception class io.github.simplejdbcmapper.exception.AnnotationException
 
assemble(Relationship...) - Method in class io.github.simplejdbcmapper.relationship.RelationshipMapper
Assembles the relationships from the query results.
AttributeConverter<T,U> - Interface in io.github.simplejdbcmapper.core
A class that implements this interface can be used to convert entity attribute into database column representation and back.
AUTO_GENERATED - Enum constant in enum class io.github.simplejdbcmapper.annotation.IdType
 

C

catalog() - Element in annotation interface io.github.simplejdbcmapper.annotation.Table
 
close() - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Closes down SimpleJdbcMapper.
Column - Annotation Interface in io.github.simplejdbcmapper.annotation
Properties that need be persisted to the database will need this annotation unless the property is already annotated with one of the other annotations.
converter() - Element in annotation interface io.github.simplejdbcmapper.annotation.Column
custom converter
convertToDatabaseColumn(T) - Method in interface io.github.simplejdbcmapper.core.AttributeConverter
Converts the value stored in the entity attribute into the data representation to be stored in the database.
convertToEntityAttribute(U) - Method in interface io.github.simplejdbcmapper.core.AttributeConverter
Converts the data stored in the database column into the value to be stored in the entity attribute.
CreatedBy - Annotation Interface in io.github.simplejdbcmapper.annotation
If a Supplier is configured with SimpleJdbcMapper, the property annotated will be set to the value supplied when the record is created.
CreatedOn - Annotation Interface in io.github.simplejdbcmapper.annotation
If a Supplier is configured with SimpleJdbcMapper, the property annotated will be set to the value supplied when the record is created.

D

delete(Object) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deletes the object from the database.
deleteById(Class<?>, Object) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deletes the object from the database by id.

E

entityRowMapper(Class<T>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Returns a new EntityRowMapper.
EntityRowMapper<T> - Class in io.github.simplejdbcmapper.core
A row mapper for mapped objects.

F

findAll(Class<T>, SortBy...) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Instead, issue an SQL query to retrieve the data using JdbcTemplate and EntityRowMapper

Find all objects.

findById(Class<T>, Object) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
finds the object by Id.
findByPropertyValue(Class<T>, String, Object, SortBy...) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Instead, issue an SQL query to retrieve the data using JdbcTemplate and EntityRowMapper

Returns list of objects which match the property value. 'IS NULL' clause will be used in the sql for a null value.

findByPropertyValues(Class<T>, String, Collection<U>, SortBy...) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Instead, issue an SQL query with JdbcTemplate and EntityRowMapper to retrieve the data

Returns list of objects which match the collection of property values. Uses an sql 'IN' clause. Large number of values could cause query performance degradation. Also different databases have different number/size limitations for sql 'IN" clauses.

 Query is constructed in such a way that if there is a null value in the propertyValues
 the returned records will include records which match 'IS NULL' in the database.
             

G

getBeanFriendlySqlColumns(Class<?>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Instead use getSqlColumns() with EntityRowMapper to retrieve data

Gets the sql columns. Works well with Spring row mappers like BeanPropertyRowMapper(), SimplePropertyRowMapper() etc. Will create the needed column aliases where the column name does not match the corresponding underscore case property name.

It is a good practice to store this string, since every time this method is invoked the columns have to be concatenated along with some string manipulation

Will return something like below if 'name' property is mapped to 'last_name' column in database:

             "somecolumn, someothercolumn, last_name AS name"
             
Example:
             String sql = "SELECT " + sjm.getBeanFriendlySqlColumns(Product.class) + " FROM product WHERE product_name = ?";
             
Using Spring's JdbcClient api for the above sql. JdbcClient is using SimplePropertyRowMapper internally here.
 List<Product> products = sjm.getJdbcClient().sql(sql).param("someProductName").query(Product.class).list();
 
Using Spring's JdbcTemplate api for the above sql
 List<Product> products = sjm.getJdbcTemplate().query(sql, BeanPropertyRowMapper.newInstance(Product.class), "someProductName");
 
getBeanFriendlySqlColumns(Class<?>, String) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Instead use getSqlColumns() with EntityRowMapper to retrieve data

Gets the sql columns with columns prefixed with the table alias. Works well with Spring row mappers like BeanPropertyRowMapper(), SimplePropertyRowMapper() etc. Will prefix table column names with the 'tableAlias.' and will create the needed column aliases where the column name does not match the corresponding underscore case property name.

Use it in your custom queries when you are doing joins and need columns corresponding to a table alias.

It is a good practice to store this string, since every time this method is invoked the columns have to be concatenated long with some string manipulation.

For tableAlias argument 't1' will return something like below if 'name' property is mapped to 'last_name' column in database:

             "t1.somecolumn, t1.someothercolumn, t1.last_name AS name"
             
Example:
             String sql = "SELECT " + sjm.getBeanFriendlySqlColumns(Product.class, "t1")
                        + " FROM product t1 WHERE t1.product_name = ?";
             
Using Spring's JdbcClient api for the above sql. JdbcClient is using SimplePropertyRowMapper internally here.
 List<Product> products = sjm.getJdbcClient().sql(sql).param("someProductName").query(Product.class).list();
 
Using Spring's JdbcTemplate api for the above sql
 List<Product> products = sjm.getJdbcTemplate().query(sql, BeanPropertyRowMapper.newInstance(Product.class), "someProductName");
 
getCatalogName() - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Get the catalog name.
getConversionService() - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
See AttributeConverter on how to use custom converters.

Exposing the conversion service used, so if necessary new converters can be added etc. The default conversion service used in SimpleJdbcMapper is Spring's DefaultConversionService.

getDirection() - Method in class io.github.simplejdbcmapper.core.SortBy
Deprecated.
 
getEntitySqlColumns(Class<?>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Use SimpleJdbcMapper.getSqlColumns(Class<?> entityType) instead.

Gets the sql columns that works with EntityRowMapper. EntityRowMapper expects the sql columns to be in a specific order since it uses position indexes to retrieve the data from the query ResultSet. Do not modify the generated sql columns.

Always use this method (or its overloaded method SimpleJdbcMapper.getEntitySqlColumns(Class<?> entityType, String tableAlias)) to create your custom query columns when using EntityRowMapper. EntityRowMapper will handle the column to property mapping.

             "somecolumn, some_other_column, last_name"
             
See SimpleJdbcMapper.newEntityRowMapper(java.lang.Class<T>)
getEntitySqlColumns(Class<?>, String) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Use SimpleJdbcMapper.getSqlColumns(Class<?> entityType, String tableAlias) instead.

Gets the sql columns with table aliases that works with EntityRowMapper. EntityRowMapper expects the sql columns to be in a specific order since it uses position indexes to retrieve the data from the query ResultSet. Do not modify the generated sql columns.

Always use this method (or its overloaded method SimpleJdbcMapper.getEntitySqlColumns(Class<?> entityType)) to create your custom query columns when using EntityRowMapper. create your custom query columns when using EntityRowMapper. EntityRowMapper will handle the column to property mapping.

Use it in your custom queries when you are doing joins and need columns corresponding to a table alias.

For tableAlias argument 't1' will return something like below:

             "t1.somecolumn, t1.someothercolumn, t1.last_name"
             
Its good practice to keep the table aliases short and succinct. See SimpleJdbcMapper.newEntityRowMapper(java.lang.Class<T>)
getFullyQualifiedTableName(Class<?>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Get fully qualified table name
getIdPropertyName(Class<?>) - Method in class io.github.simplejdbcmapper.relationship.RelationshipMapper
Get the Id property name for type.
getJdbcClient() - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Gets the JdbcClient of the SimpleJdbcMapper.
getJdbcTemplate() - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Gets the JdbcTemplate of the SimpleJdbcMapper.
getList(Class<E>) - Method in interface io.github.simplejdbcmapper.relationship.GetListSpec
Gets list by type for the relationship
getList(Class<T>) - Method in class io.github.simplejdbcmapper.relationship.RelationshipMapper
returns the results for the type
GetListSpec - Interface in io.github.simplejdbcmapper.relationship
Get list by type interface.
getMultiEntitySqlColumns(MultiEntity) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Use SimpleJdbcMapper.getSqlColumns(MultiEntity multiEntity) instead.
Gets the sql columns for multi-entity processing. These sql columns are used with the ResultSetExtractor and should not be modified since the extractor uses position indexes to retrieve the data from the query ResultSet.

For the following multi-entity:

             new MultiEntity().add(Order.class, "o").add(OrderLine.class, "ol")
             
this will generate sql columns like below:
 o.id, o.order_date, ol.id, ol.product_id ...
             
Its good practice to keep the table aliases short and succinct. See SimpleJdbcMapper.resultSetExtractor(io.github.simplejdbcmapper.core.MultiEntity)
getNamedParameterJdbcTemplate() - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Gets the NamedParameterJdbcTemplate of the SimpleJdbcMapper.
getPropertyName() - Method in class io.github.simplejdbcmapper.core.SortBy
Deprecated.
 
getPropertyToColumnMappings(Class<?>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
returns a map with all the properties of the mapped class and their corresponding column names
getSchemaName() - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Get the schema name.
getSqlColumns(MultiEntity) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Gets the sql columns for multi-entity processing.
getSqlColumns(Class<?>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Gets the sql columns that works with EntityRowMapper.
getSqlColumns(Class<?>, String) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Gets the sql columns with table aliases that works with EntityRowMapper.

I

Id - Annotation Interface in io.github.simplejdbcmapper.annotation
Annotation for Identifier.
IdType - Enum Class in io.github.simplejdbcmapper.annotation
The type of the @id annotation.
insert(Object) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Inserts an object.
io.github.simplejdbcmapper.annotation - package io.github.simplejdbcmapper.annotation
 
io.github.simplejdbcmapper.core - package io.github.simplejdbcmapper.core
 
io.github.simplejdbcmapper.exception - package io.github.simplejdbcmapper.exception
 
io.github.simplejdbcmapper.relationship - package io.github.simplejdbcmapper.relationship
 

J

joinOn(String, String) - Method in interface io.github.simplejdbcmapper.relationship.RelationshipFluent.ToMany
The properties on each list whose values should be matched to populate the toMany relationship.
joinOn(String, String) - Method in interface io.github.simplejdbcmapper.relationship.RelationshipFluent.ToOne
The properties on the two lists whose values should be matched to populate the toOne relationship.

M

MANUAL - Enum constant in enum class io.github.simplejdbcmapper.annotation.IdType
 
MapperException - Exception Class in io.github.simplejdbcmapper.exception
Generic Mapper Exception.
MapperException(Exception) - Constructor for exception class io.github.simplejdbcmapper.exception.MapperException
 
MapperException(String) - Constructor for exception class io.github.simplejdbcmapper.exception.MapperException
 
MapperException(String, Exception) - Constructor for exception class io.github.simplejdbcmapper.exception.MapperException
 
mapRow(ResultSet, int) - Method in class io.github.simplejdbcmapper.core.EntityRowMapper
 
MultiEntity - Class in io.github.simplejdbcmapper.core
Used in multi-entity processing.
MultiEntity() - Constructor for class io.github.simplejdbcmapper.core.MultiEntity
 

N

name() - Element in annotation interface io.github.simplejdbcmapper.annotation.Column
column name
name() - Element in annotation interface io.github.simplejdbcmapper.annotation.Table
 
newEntityRowMapper(Class<T>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
Use SimpleJdbcMapper.entityRowMapper(Class) instead.

Returns a new EntityRowMapper.

EntityRowMapper always has to be used with sql columns generated by either

 SimpleJdbcMapper.getEntitySqlColumns(Class<?> entityType) or
 SimpleJdbcMapper.getEntitySqlColumns(Class<?> entityType, String tableAlias)
 

It expects the sql columns to be in a specific order because it uses position indexes to retrieve the data from the query ResultSet. It will handle the cases where the column to property mappings do not follow the underscore to camel case naming convention.

This is the recommended row mapper to use when writing custom queries for mapped objects. It has optimizations which allows it to process data from the query ResultSet in a performant way.

Query:

             String sql = "SELECT " + sjm.getEntitySqlColumns(Product.class) + "FROM product WHERE name = ?";
             
Example using JdbcTemplate:
 List<Product> products = sjm.getJdbcTemplate().query(sql,sjm.newEntityRowMapper(Product.class), "someProductName");
 

Example using JdbcClient. Note that the EntityRowMaper has to be passed in as an argument, otherwise JdbcClient will use its internal row mapper SimplePropertyRowMapper which will not work with the sql.

 List<Product> products = sjm.getJdbcClient().sql(sql)
                                                     .param("someProductName")
                                                     .query(sjm.newEntityRowMapper(Product.class))
                                                     .list();
 

O

OptimisticLockingException - Exception Class in io.github.simplejdbcmapper.exception
updates with stale data will throw this exception when model property is annotated with @Version.
OptimisticLockingException(String) - Constructor for exception class io.github.simplejdbcmapper.exception.OptimisticLockingException
 

P

populate(String) - Method in interface io.github.simplejdbcmapper.relationship.RelationshipFluent.Populate
The property to populate on the main object.

R

Relationship - Class in io.github.simplejdbcmapper.relationship
The relationship definition.
RelationshipFluent - Interface in io.github.simplejdbcmapper.relationship
The relationship fluent api interface.
RelationshipFluent.Populate - Interface in io.github.simplejdbcmapper.relationship
The populate interface.
RelationshipFluent.RelationshipType - Interface in io.github.simplejdbcmapper.relationship
The relationship type interface.
RelationshipFluent.ToMany - Interface in io.github.simplejdbcmapper.relationship
The toMany interface.
RelationshipFluent.ToOne - Interface in io.github.simplejdbcmapper.relationship
The toOne interface.
RelationshipMapper - Class in io.github.simplejdbcmapper.relationship
This holds the results from a multi-entity query.
RelationshipMapper() - Constructor for class io.github.simplejdbcmapper.relationship.RelationshipMapper
 
resultSetExtractor(MultiEntity) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
The ResultSetExtractor for multiple entities.

S

schema() - Element in annotation interface io.github.simplejdbcmapper.annotation.Table
 
setConversionService(ConversionService) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Deprecated, for removal: This API element is subject to removal in a future version.
See AttributeConverter on how to use custom converters.

Set the conversion service

setRecordAuditedBySupplier(Supplier<T>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Set the Supplier that is used to populate the @CreatedBy and @UpdatedBy annotated properties.
setRecordAuditedOnSupplier(Supplier<T>) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Set the Supplier that is used to populate the @CreatedOn and @UpdatedOn annotated properties.
SimpleJdbcMapper - Class in io.github.simplejdbcmapper.core
CRUD methods and configuration for SimpleJdbcMapper.
SimpleJdbcMapper(DataSource) - Constructor for class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Constructor.
SimpleJdbcMapper(DataSource, String) - Constructor for class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Constructor.
SimpleJdbcMapper(DataSource, String, String) - Constructor for class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Constructor.
SortBy - Class in io.github.simplejdbcmapper.core
Deprecated, for removal: This API element is subject to removal in a future version.
Instead, issue an SQL query with ORDER BY clause and retrieve the data using JdbcTemplate and EntityRowMapper

This is used to generate the "ORDER BY" clause for the queries.

SortBy(String) - Constructor for class io.github.simplejdbcmapper.core.SortBy
Deprecated.
The constructor
SortBy(String, String) - Constructor for class io.github.simplejdbcmapper.core.SortBy
Deprecated.
The constructor
sqlType() - Element in annotation interface io.github.simplejdbcmapper.annotation.Column
column sqlType

T

Table - Annotation Interface in io.github.simplejdbcmapper.annotation
Annotation to map an object to a database/view table.
through(Class<?>, String, String) - Method in interface io.github.simplejdbcmapper.relationship.RelationshipFluent.ToMany
The 'through' information when defining a toMany relationship through an intermediate table (one side of many to many).
toMany(Class<?>) - Method in interface io.github.simplejdbcmapper.relationship.RelationshipFluent.RelationshipType
A toMany relationship.
toOne(Class<?>) - Method in interface io.github.simplejdbcmapper.relationship.RelationshipFluent.RelationshipType
A toOne relationship.
toString() - Method in class io.github.simplejdbcmapper.core.EntityRowMapper
 
toString() - Method in class io.github.simplejdbcmapper.relationship.Relationship
 
type() - Element in annotation interface io.github.simplejdbcmapper.annotation.Id
 
type(Class<?>) - Static method in class io.github.simplejdbcmapper.relationship.Relationship
Starts the relationship fluent flow.

U

update(Object) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Update the object.
UpdatedBy - Annotation Interface in io.github.simplejdbcmapper.annotation
If a Supplier is configured with SimpleJdbcMapper, the annotated property value will be set to the value supplied when the record is updated.
UpdatedOn - Annotation Interface in io.github.simplejdbcmapper.annotation
If a Supplier is configured with SimpleJdbcMapper, the annotated property value will be set to the value supplied when the record is updated.
updateSpecificProperties(Object, String...) - Method in class io.github.simplejdbcmapper.core.SimpleJdbcMapper
Updates only the specified properties passed in as arguments.

V

valueOf(String) - Static method in enum class io.github.simplejdbcmapper.annotation.IdType
Returns the enum constant of this class with the specified name.
values() - Static method in enum class io.github.simplejdbcmapper.annotation.IdType
Returns an array containing the constants of this enum class, in the order they are declared.
Version - Annotation Interface in io.github.simplejdbcmapper.annotation
This annotation is used for optimistic locking.
A C D E F G I J M N O P R S T U V 
All Classes and Interfaces|All Packages|Serialized Form