RE: JPA required?

2013-02-13 Thread Bergquist, Brett
For your use case, probably not.   JPA is not something that is going to solve 
a database element corruption and in fact with JPA and its normal use, you have 
less control when entity changes are flushed to the database.

Note that if you don't have your database stored on medium that has write 
caching, if the host computer goes down, the database is not going to be 
corrupt; it might not have the latest change, but it will be consistent if you 
are using transactions.

-Original Message-
From: JimCrowell37 [mailto:jimcrow...@email.com] 
Sent: Tuesday, February 12, 2013 4:52 PM
To: derby-user@db.apache.org
Subject: JPA required?

Hello,

I have spent today reading up on JPA and I have a question if I really need it.

I have a data entry form class where each data entry field is associated with 
an element of a Derby dynamic database table. As each data entry field looses 
it's form focus, I shall write the entered data entry value to the Database 
table. The Database table primary key is the fields row / column indices.

Since my goal is to save all data entries in a persistent manner, my question 
is do I need to implement JPA?

I think that the worst case scenario is that my end users host computer goes 
down sometime during the Database write processing and that Database element 
may be corrupted.

That thought is what led me to learning about JPA to persist the Database 
transaction.

Do I need to implement JPA or is there a better way to achieve my persistence 
goal?

Regards,
Jim...



--
View this message in context: 
http://apache-database.10148.n7.nabble.com/JPA-required-tp127242.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.




RE: JPA required?

2013-02-13 Thread JimCrowell37
Bergquist, Brett-2 wrote
 For your use case, probably not.   JPA is not something that is going to
 solve a database element corruption and in fact with JPA and its normal
 use, you have less control when entity changes are flushed to the
 database.
 
 Note that if you don't have your database stored on medium that has write
 caching, if the host computer goes down, the database is not going to be
 corrupt; it might not have the latest change, but it will be consistent if
 you are using transactions.

Brett...
My Derby Database is hosted on my HDD in a /db folder under the Java
Application folder...

 ... if you are using transactions.
The above phrase made me look at my code to see if I am using transactions.
I wrote the derby software some time ago and I have the following lines of
code but I
do not understand why I did the conn.setAutoCommit(false) statement...

//  Control transactions manually...
//  NOTE:   Auto commit is on by default in JDBC...
conn.setAutoCommit(false);

Everything is working fine but I wanted to assure myself that the above
operation is OK.

Many Thanks,
Jim...





--
View this message in context: 
http://apache-database.10148.n7.nabble.com/JPA-required-tp127242p127277.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: JPA required?

2013-02-13 Thread JimCrowell37
José,

José Ventura-3 wrote
 Just a quick tip: Derby's documentation includes examples and tutorials
 that do not use JPA. Start here and work your way through Activities 3 and
 4:
 
 http://db.apache.org/derby/docs/10.9/getstart/index.html
 
 Hope that helps.

Yes it did help.
I have my Embedded Derby Database setup and have several tables created and
debugged.

I used the tutorial to compare with my Derby code.
The Tutorial alerted me that I do not currently shut down my Derby Database
when my end user terminates my application. Also, I have a Soft Abort
capability that also needs to terminate the db.

I'll use the Tutorial as a reference when I add the Database termination
code...

I knew about the Network Server capability but do not see how I would use it
in my stand alone Java application. A subset of my Derby Database shall be
uploaded to a 'MySQL' record on my Server. This subset shall then be used to
produce application reports via a Web Browser.

The subset upload to server processing is, I think, independent to the Derby
Database and yet another learning curve for me.

Thanks,
Jim...




--
View this message in context: 
http://apache-database.10148.n7.nabble.com/JPA-required-tp127242p127279.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.