Package com.jk.data.dataaccess.orm
Class JKEntity
java.lang.Object
com.jk.data.dataaccess.orm.JKEntity
- All Implemented Interfaces:
 Serializable
This class provides common functionality and annotations for entity classes.
 
Entities that extend this class are expected to include annotations such as `@Id`, `@GeneratedValue`, and `@Column` for mapping to database tables.
This class offers utility methods for working with entities, such as retrieving table name, column information, and sorting information.
- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 - See Also:
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.This method retrieves the alias name for this entity class.static List<JKColumnWrapper>getColumns(Class<? extends JKEntity> clas) This method retrieves a list of column wrappers for the columns in the specified entity class.jakarta.persistence.ColumnThis method retrieves the first column in this entity class that is not marked as the primary key.This method gets the column wrapper representing the primary key (ID column) for thisJKEntityclass.static JKColumnWrappergetIdColumn(Class<? extends JKEntity> clas) This method gets the column wrapper representing the primary key (ID column) for the specified JKEntity class.<T> TThis method gets the value of the primary key (ID) field for this entity.static JKSortInfogetSortInfo(Class<? extends JKEntity> clas) This method retrieves the sort information associated with a class.This method gets the primary table name of this entity.inthashCode()Returns a hash code value for the object.static voidprintFieldAnnotations(Field field) This method prints the annotations applied to a given field.voidThis method prints the annotations of fields within the currentJKEntityclass.toString()Returns a string representation of the object. 
- 
Constructor Details
- 
JKEntity
public JKEntity()This method constructs a newJKEntity. 
 - 
 - 
Method Details
- 
getTableName
This method gets the primary table name of this entity.- Returns:
 - the primary table name of this entity.
 
 - 
getIdValue
public <T> T getIdValue()This method gets the value of the primary key (ID) field for this entity.- Type Parameters:
 T- Specifies the type of the primary key value.- Returns:
 - the value of the primary key field.
 
 - 
getFirstNonIdColumn
public jakarta.persistence.Column getFirstNonIdColumn()This method retrieves the first column in this entity class that is not marked as the primary key.- Returns:
 - the first non-primary key column in the entity class, or null if none was found.
 
 - 
getColumns
This method retrieves a list of column wrappers for the columns in the specified entity class.- Parameters:
 clas- Specifies the entity class for which to retrieve the columns.- Returns:
 - a list of column wrappers representing the columns in the entity class.
 
 - 
getIdColumn
This method gets the column wrapper representing the primary key (ID column) for thisJKEntityclass.- Returns:
 - a 
JKColumnWrapperrepresenting the primary key column. 
 - 
getIdColumn
This method gets the column wrapper representing the primary key (ID column) for the specified JKEntity class.- Parameters:
 clas- Specifies theJKEntityclass for which to retrieve the ID column.- Returns:
 - a 
JKColumnWrapperrepresenting the primary key column. 
 - 
printFieldsAnnotations
public void printFieldsAnnotations()This method prints the annotations of fields within the currentJKEntityclass. - 
printFieldAnnotations
This method prints the annotations applied to a given field.- Parameters:
 field- Specifies the field for which annotations should be printed.
 - 
toString
Returns a string representation of the object. - 
getSortInfo
This method retrieves the sort information associated with a class.- Parameters:
 clas- Specifies the class for which sort information is retrieved.- Returns:
 - the sort information associated with the class, or null if none is found.
 
 - 
equals
Indicates whether some other object is "equal to" this one.The
equalsmethod implements an equivalence relation on non-null object references:- It is reflexive: for any non-null reference value
 
x,x.equals(x)should returntrue. - It is symmetric: for any non-null reference values
 
xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue. - It is transitive: for any non-null reference values
 
x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue. - It is consistent: for any non-null reference values
 
xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified. - For any non-null reference value 
x,x.equals(null)should returnfalse. 
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
 - It is reflexive: for any non-null reference value
 
 - 
hashCode
public int hashCode()Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided byHashMap.The general contract of
hashCodeis:- Whenever it is invoked on the same object more than once during
 an execution of a Java application, the 
hashCodemethod must consistently return the same integer, provided no information used inequalscomparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the 
equalsmethod, then calling thehashCodemethod on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal
 according to the 
equalsmethod, then calling thehashCodemethod on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables. 
 - Whenever it is invoked on the same object more than once during
 an execution of a Java application, the 
 - 
getAliasName
This method retrieves the alias name for this entity class.- Returns:
 - the alias name, which is the simple name of the class.
 
 
 -