0

I am trying to use Omnipersistence for the first time on a new Maven project and get the following error in Eclipse: The entity has no primary key attribute defined

import org.omnifaces.persistence.model.TimestampedEntity;
@Entity
public class ShoppingCart extends TimestampedEntity<Long> {

    ...
}

While trying to figure out the issue, I happened to add a constructor with this.id = id, and Eclipse gave a warning that stated id is not visible but when I control-clicked on id, it took me to the TimestampedEntity class.

jeff
  • 3,618
  • 9
  • 48
  • 101
  • Please pick a question and post a [mcve] – Mad Physicist Jan 10 '22 at 04:30
  • 1
    @Mad: that's not needed. The question was fine. See abovelinked dupe for answer. This is an Eclipse quirk. You need to manually add any `@MappedSuperclass` such as `TimestampedEntity` to list of classes in `persistence.xml` as well. – BalusC Jan 10 '22 at 10:03
  • @BalusC. Fair enough, but also there are two questions here. – Mad Physicist Jan 10 '22 at 10:23

0 Answers0