mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
49 lines
874 B
Java
49 lines
874 B
Java
package com.avaje.tests.model.basic;
|
|
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.OneToOne;
|
|
|
|
import com.avaje.ebean.annotation.Sql;
|
|
|
|
/**
|
|
* An example of an Aggregate object.
|
|
* <p>
|
|
* Note the @Sql indicates to Ebean that this bean is not based on a table but
|
|
* instead uses RawSql.
|
|
* </p>
|
|
*/
|
|
@Entity
|
|
@Sql
|
|
public class CustomerAggregate {
|
|
|
|
@OneToOne
|
|
Customer customer;
|
|
|
|
int totalContacts;
|
|
|
|
|
|
public String toString() {
|
|
return customer.getId() + " totalContacts:" + totalContacts;
|
|
}
|
|
|
|
|
|
public Customer getCustomer() {
|
|
return customer;
|
|
}
|
|
|
|
|
|
public void setCustomer(Customer customer) {
|
|
this.customer = customer;
|
|
}
|
|
|
|
|
|
public int getTotalContacts() {
|
|
return totalContacts;
|
|
}
|
|
|
|
|
|
public void setTotalContacts(int totalContacts) {
|
|
this.totalContacts = totalContacts;
|
|
}
|
|
}
|