Setting a JPA timestamp column to be generated by the database?

I fixed the issue by changing the code to @Basic(optional = false) @Column(name = “LastTouched”, insertable = false, updatable = false) @Temporal(TemporalType.TIMESTAMP) private Date lastTouched; So the timestamp column is ignored when generating SQL inserts. Not sure if this is the best way to go about this. Feedback is welcome.

Persistence unit as RESOURCE_LOCAL or JTA?

JPA implementations have the choice of managing transactions themselves (RESOURCE_LOCAL), or having them managed by the application server’s JTA implementation. In most cases, RESOURCE_LOCAL is fine. This would use basic JDBC-level transactions. The downside is that the transaction is local to the JPA persistence unit, so if you want a transaction that spans multiple persistence … Read more

When to use EntityManager.find() vs EntityManager.getReference() with JPA

I usually use getReference method when i do not need to access database state (I mean getter method). Just to change state (I mean setter method). As you should know, getReference returns a proxy object which uses a powerful feature called automatic dirty checking. Suppose the following public class Person { private String name; private … Read more

How persistent is localStorage?

Mozilla implements it like cookies: DOM Storage can be cleared via “Tools -> Clear Recent History -> Cookies” when Time range is “Everything” (via nsICookieManager::removeAll) https://developer.mozilla.org/en/DOM/Storage In DOM Storage it is not possible to specify an expiration period for any of your data. All expiration rules are left up to the user. In the case … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)