All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.onetwo.dbm.mapping.DbmMappedEntry Maven / Gradle / Ivy

The newest version!
package org.onetwo.dbm.mapping;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.onetwo.dbm.dialet.DBDialect;
import org.onetwo.dbm.id.IdentifierGenerator;
import org.onetwo.dbm.mapping.SQLBuilderFactory.SqlBuilderType;

public interface DbmMappedEntry extends DbmMappedEntryMeta {
	DBDialect getDbDialect();
	Map> getIdGenerators();
	void addIdGenerator(IdentifierGenerator idGenerator);
	
	
	DbmTypeMapping getSqlTypeMapping();

	void setId(Object entity, Object value);

	/***
	 * 如果是复合主键,则返回复合主键对象
	 * @author weishao zeng
	 * @param entity
	 * @return
	 */
	Serializable getId(Object entity);
	/****
	 * 如果是复合主键,则返回多个值
	 * @author weishao zeng
	 * @param entity
	 * @return
	 */
	Object[] getIds(Object entity);

	void setFieldValue(Object entity, String fieldName, Object value);


	String getColumnName(String field);


	Object getFieldValue(Object entity, String fieldName);

	/*******
	 * 此方法会延迟调用,会设置各种属性和manager的事件回调后,才会调用,
	 * 所以,如果没有实现扫描和构建所有实体,而在运行时才build,就要注意多线程的问题
	 */
	void buildEntry();


	

	 T newInstance();

	boolean isDynamic();

	void setDynamic(boolean dynamic);



//	String getStaticInsertSql();

//	String getStaticUpdateSql();

//	String getStaticFetchSql();

	/*String getStaticSeqSql();
	String getStaticCreateSeqSql();*/
	
	JdbcStatementContext makeSelectVersion(Object object);
	
	JdbcStatementContext makeFetchAll();
	
	JdbcStatementContext makeDeleteAll();
	
	/****
	 * 
	 * @author wayshall
	 * @param objects
	 * @param isIdentify 是否根据id查询
	 * @return
	 */
	JdbcStatementContext> makeFetch(Object objects, boolean isIdentify);
	
//	JdbcStatementContext makeLockSelect(Object object, LockInfo lock);
	
	JdbcStatementContext> makeInsert(Object entity);
	
	JdbcStatementContext> makeMysqlInsertOrUpdate(Object entity);
	JdbcStatementContext> makeMysqlInsertOrIgnore(Object entity);

	/***
	 * make delete by id
	 * 
	 * @author weishao zeng
	 * @param objects
	 * @return
	 */
	JdbcStatementContext> makeDelete(Object objects);

	JdbcStatementContext> makeUpdate(Object entity);

	JdbcStatementContext> makeDymanicUpdate(Object entity);

	Map getMappedFields();
	Map getMappedColumns();

	/*boolean isQueryableOnly();

	void setQueryableOnly(boolean queryableOnly);*/
	
	/*void addAnnotations(Annotation...annotations);
	
	boolean hasAnnotation(Class annoClass);
	
	 T getAnnotation(Class annoClass);*/
	
	void freezing();
	boolean isFreezing();
	
	boolean hasIdentifyValue(Object entity);
//	Collection getJoinMappedFields();
	
	SQLBuilderFactory getSqlBuilderFactory();
	
//	DataHolder getDataHolder();
	
	EntrySQLBuilder createSQLBuilder(SqlBuilderType type);
	
//	JdbcStatementContextBuilder createJdbcStatementContextBuilder(SqlBuilderType type);
	
	List getEntityListeners();
	List getFieldListeners();
	
	EntrySQLBuilder getStaticFetchSqlBuilder();
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy