Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JPA Entity static logger

My question is, can i use a static logger in a JPA Entity, or will it cause some problem? I would like to do something like this (the logger is log4j):

    @Entity
public class AlertRule implements Serializable {
/**
 * Serial version ID.
 */
private static final long serialVersionUID = 9000392523924653431L;

/**Logger. */
transient private static final Logger LOGGER = Logger.getLogger(AlertRule.class);

/**
 * ID.
 */
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private Long id;

/**
 * Rule name.
 */
@NotNull
private String name;

...
like image 203
Kari5 Avatar asked Jun 25 '13 13:06

Kari5


1 Answers

With standard JPA, static fields are not persisted, and final fields are not persisted, so its not a problem

like image 66
DataNucleus Avatar answered Oct 09 '22 16:10

DataNucleus