JPA Deployment

7 views
Skip to first unread message

Cristiano Tomasi

unread,
May 15, 2012, 2:20:46 PM5/15/12
to jug...@googlegroups.com
Ciao a tutti

vorrei fare il deployment di applicazione jpa, e il primo dubbio che mi sorge e':

se il mio file persistence.xml contiene la stringa

      <property name="javax.persistence.jdbc.url" value="jdbc:h2://opt/databases/h2/LMJ/LMJ.db;Schema=LMJ;Schema=LMJ;/>

ovvero il path del mio db h2sql, devo creare in fase di installazione questo file (persistence.xml) nel quale specificare il corretto percorso del file?

oppure c'e' un modo in fase di creazione EntityFactoryManager che legge appunto il file persistence.xml, di forzare le proprietà inserite nell'xml stesso?

     emf = javax.persistence.Persistence.createEntityManagerFactory("lmjPU");


saluti
Cristiano

Tiziano Lattisi

unread,
May 15, 2012, 3:37:09 PM5/15/12
to jug...@googlegroups.com
createEntityManagerFactory ha un costruttore che prevede come secondo parametro
una mappa da usare per l'overriding delle proprietà, che penso sia
quello che cerchi:

http://docs.oracle.com/javaee/6/api/javax/persistence/Persistence.html#createEntityManagerFactory(java.lang.String,
java.util.Map)

ciao
t.
> --
> You received this message because you are subscribed to the Google Groups
> "JUG Trentino Alto Adige Suedtirol" group.
> To post to this group, send email to jug...@googlegroups.com.
> To unsubscribe from this group, send email to
> jugtaa+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jugtaa?hl=en.



--
-- Tiziano Lattisi

Cristiano Tomasi

unread,
May 15, 2012, 4:38:08 PM5/15/12
to jug...@googlegroups.com
Grazie Tiziano

era proprio quello che cercavo

bye
Cris.


2012/5/15 Tiziano Lattisi <tiziano...@gmail.com>
Reply all
Reply to author
Forward
0 new messages