actframework / act-eclipselink

Provide JPA support via EclipseLink
Apache License 2.0
1 stars 1 forks source link

ACT could not support @Cache annonation #9

Open leeaee opened 6 years ago

leeaee commented 6 years ago

From the eclipselink wiki, we config the cache for entity bean, but it seem not working. https://wiki.eclipse.org/EclipseLink/Examples/JPA/Caching

@DB
@Entity
@Table(name = "u_user_address")
@Cache(type = CacheType.SOFT, size = 64000, expiry = 36000000, coordinationType = CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS)
public class UserAddress extends BaseEntity implements SimpleBean, UserLinked {

    public static final String KEY = "entity.user.address";

    @Column(name = "user_id", nullable = false, updatable = false)
    public Long userId;

    @NotNull
    public String name;

    @NotNull
    public String phone;

    @NotNull
    public String province;

    ...
}

The eclipselink log show the SQL executed everytime.

2018-10-23 11:10:16.809 [XNIO-1 task-2] DEBUG e.logging.sql - SELECT ID, ADDRESS, CITY, create_time, is_def, is_del, DISTRICT, LATITUDE, LONGITUDE, NAME, PHONE, POSTCODE, PROVINCE, update_time, user_id, VERSION FROM u_user_address WHERE (ID = ?)
    bind => [1]