0

I'm using Netbeans 8.1, Java EE 7, and MS SQL Server. The application does transactions that contain individual items stored in a separate table. I need the primary key txId to create the individual records that are linked with a Foreign Key. Here is an excerpt from the entity:

public class Transactions implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "tx_id")
    private Long txId;
    //remainder left off for brevity
}

Here is an excerpt from the client:

public void create() {
    persist(PersistAction.CREATE, "blah");
}

My major question is how can I get the Primary Key returned back from the persist() method?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
davef
  • 77
  • 1
  • 6

0 Answers0