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;
...
With standard JPA, static fields are not persisted, and final fields are not persisted, so its not a problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With