title: What's the difference between the name argument in @Entity and @Table when using JPA?
body: <p>I'm using JPA2 and both <code>@Entity</code> and <code>@Table</code> have a <code>name</code> attribute, e. g.:</p>
  
  <pre><code>@Entity(name="Foo")
  @Table (name="Bar")
  class Baz
  </code></pre>
  
  <p>What should I use, which ones are optional? </p>
  
  <p>In my specific case I have a class <code>User</code> and a class <code>Group</code>, which have additional requirements (as far as I understand) because they are reserved words in SQL.</p>
  
  <p>How would a working solution look like and with which name would I refer to the entity when writing queries?</p>
  
  <p>Update: I added <code>name="GROUPS"</code> to both annotations in <code>Group</code> and did the same for <code>User</code>, but now I get this error: </p>
  
  <pre><code>Exception Description: The table [USERS] is not present in this descriptor.
  Descriptor: RelationalDescriptor(example.Group --&gt; [DatabaseTable(GROUPS)])
  </code></pre>
  
  <p>and this error</p>
  
  <pre><code>Internal Exception: java.sql.SQLException: Table not found in statement [SELECT ID, MAXIMUMROLE, MEMBERSHIPS_ID FROM USERS]
  </code></pre>