Mysql maven jpa skeleton
Posted
by coubeatczech
on Stack Overflow
See other posts from Stack Overflow
or by coubeatczech
Published on 2010-05-16T14:57:56Z
Indexed on
2010/05/16
15:00 UTC
Read the original article
Hit count: 189
Hi, is there a skeleton for a project using mysql, some eclipse/top link with RESOURCE_LOCAL as connection type? Preferably using maven. I'm searching for it for hours and can't get running even the sipmlest exaple. So if you had it ready and running, please, post :-). Even something as simple as these two classes only.
@Entity
public class Message implements Serializable{
public Message() {}
public Message(String s){
this.s = s;
}
@Id
String s;
public String getS(){
return s;
}
}
public class App {
static private EntityManagerFactory emf;
static private EntityManager em;
public static void main( String[] args ) {
emf = Persistence.createEntityManagerFactory("persistence");
em = emf.createEntityManager();
Message m = new Message("abc");
em.persist(m);
}
}
© Stack Overflow or respective owner