Search in sources :

Example 11 with Employee

use of com.querydsl.sql.domain.Employee in project querydsl by querydsl.

the class ForeignKeyTest method on.

@Test
public void on() {
    QEmployee employee = new QEmployee("employee");
    QEmployee employee2 = new QEmployee("employee2");
    ForeignKey<Employee> foreignKey = new ForeignKey<Employee>(employee, employee.superiorId, "ID");
    assertEquals("employee.superiorId = employee2.ID", foreignKey.on(employee2).toString());
    foreignKey = new ForeignKey<Employee>(employee, ImmutableList.of(employee.superiorId, employee.firstname), ImmutableList.of("ID", "FN"));
    assertEquals("employee.superiorId = employee2.ID && employee.firstname = employee2.FN", foreignKey.on(employee2).toString());
}
Also used : Employee(com.querydsl.sql.domain.Employee) QEmployee(com.querydsl.sql.domain.QEmployee) QEmployee(com.querydsl.sql.domain.QEmployee) Test(org.junit.Test)

Aggregations

Employee (com.querydsl.sql.domain.Employee)11 QEmployee (com.querydsl.sql.domain.QEmployee)10 Test (org.junit.Test)10 ExcludeIn (com.querydsl.core.testutil.ExcludeIn)1 BeanMapper (com.querydsl.sql.dml.BeanMapper)1 BigDecimal (java.math.BigDecimal)1 Date (java.sql.Date)1 Time (java.sql.Time)1 Before (org.junit.Before)1