SINSERT Key Generator [1 Attachment]
Abel Birya <[email protected]> Mon, 18 Apr 2011 08:50:24 +0300
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Message-ID | <[email protected]> |
--0016368319a0c2f4f704a12af721
Content-Type: text/plain; charset=ISO-8859-1
Hi,
I was wondering whether anyone has been able to do an implementation of this
key generator mode for MySQL. I implemented the methods
supportsInsertKeyGeneration() & retrieveInsertKey() of the SDriverMySQL.java
class and so far I am able to retrieve my inserted key from the db when a
commit() is done.
One thing that I have noticed though is that in the event that an entity
represents a foreign key in another table, I have to explicitly call the
session.flush() method in order for the entity to bear its primary key field
value before I call the setReference() method in the child record.
I was wondering whether there is anyone who has time to assist me in testing
this. I am currently working on a project that needs to work in a
multi-threaded environment where there will be many connections to the DB at
once and I wanted to find out how effective the retrieveInsertKey() method
is going to be in such an environment and whether I will be able to maintain
data integrity all across the different threads that are running.
I have attached the SDriverMySQL.java class.
Kind regards.
Abel
--0016368319a0c2f4f704a12af721
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<head>
<style type=3D"text/css">
<!--
/* start of attachment style */
.ygrp-photo-title{
clear: both;
font-size: smaller;
height: 15px;
overflow: hidden;
text-align: center;
width: 75px;
}
div.ygrp-photo{
background-position: center;
background-repeat: no-repeat;
background-color: white;
border: 1px solid black;
height: 62px;
width: 62px;
}
div.photo-title=20
a,
div.photo-title a:active,
div.photo-title a:hover,
div.photo-title a:visited {
text-decoration: none;=20
}
div.attach-table div.attach-row {
clear: both;
}
div.attach-table div.attach-row div {
float: left;
/* margin: 2px;*/
}
p {
clear: both;
padding: 15px 0 3px 0;
overflow: hidden;
}
div.ygrp-file {
width: 30px;
valign: middle;
}
div.attach-table div.attach-row div div a {
text-decoration: none;
}
div.attach-table div.attach-row div div span {
font-weight: normal;
}
div.ygrp-file-title {
font-weight: bold;
}
/* end of attachment style */
-->
</style>
</head>
<html>
<head>
<style type=3D"text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}
#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}
#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}
#ygrp-mkp #ads {
margin-bottom: 10px;
}
#ygrp-mkp .ad {
padding: 0 0;
}
#ygrp-mkp .ad p {
margin: 0;
}
#ygrp-mkp .ad a {
color: #0000ff;
text-decoration: none;
}
-->
</style>
</head>
<body>
Hi,<div><br></div><div>I was wondering whether anyone has been able to do a=
n implementation of this key generator mode for MySQL. I=A0implemented the =
methods supportsInsertKeyGeneration() & retrieveInsertKey() of the SDri=
verMySQL.java class and so far I am able to retrieve my inserted key from t=
he db when a commit() is done.</div>
<div><br></div><div>One thing that I have noticed though is that in the eve=
nt that an entity represents a foreign key in another table, I have to expl=
icitly call the session.flush() method in order for the entity to bear its =
primary key field value before I call the setReference() method in the chil=
d record.</div>
<div><br></div><div>I was wondering whether there is anyone who has time to=
assist me in testing this. I am currently working on a project that needs =
to work in a multi-threaded environment where there will be many connection=
s to the DB at once and I wanted to find out how effective the=A0retrieveIn=
sertKey() method is going to be in such an environment and whether I will b=
e able to maintain data integrity all across the different threads that are=
running.</div>
<div><br></div><div>I have attached the SDriverMySQL.java class.</div><div>=
<br></div><div>Kind regards.</div><div><br></div><div>Abel</div><div><br></=
div><meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
<!-- |**|begin egp html banner|**| -->
<br>
<a name=3D"TopText"><p style=3D"clear: both; padding: 15px 0 3px 0;">=
<span style=3D"color: #628C2A; font-weight: bold; font-size: 14px;"> Attach=
ment(s) from Abel Birya </span> </p></a>
=20=20=20=20
<p style=3D"clear: both; padding: 15px 0 3px 0;"><span style=3D"c=
olor: #628C2A; font-weight: bold;"> 1 of 1 File(s) </span>
</p>
<div class=3D"attach-table">
<div class=3D"attach-row">
<div>
<div class=3D"ygrp-file"> <img src=3D"http://l.yimg.com/kq/static/image=
s/yg/img/doc/text16x16.gif"></div>
<div class=3D"ygrp-file-title"> <a href=3D"http://xa.yimg.com/kq/groups=
/7360226/1162792790/name/SDriverMySQL%2Ejava" style=3D"">SDriverMySQL.java<=
/a></div>
</div>
</div>
</div>
=20=20
<br>
<!-- |**|end egp html banner|**| -->
<div width=3D"1" style=3D"color: white; clear: both;"/>__._,_.___</div>
<!-- Start Recommendations -->
<!-- End Recommendations -->
<!-- |**|begin egp html banner|**| -->
<img src=3D"http://geo.yahoo.com/serv?s=3D97476590/grpId=3D7360226/grpspI=
d=3D1705006905/msgId=3D2026/stime=3D1303105827" width=3D"1" height=3D"1"> <=
br>
<!-- |**|end egp html banner|**| -->
=20=20
<!-- |**|begin egp html banner|**| -->
<br>
<div style=3D"font-family: verdana; font-size: 77%; border-top: 1px s=
olid #666; padding: 5px 0;" >
Your email settings: Individual Email|Traditional <br>
<a href=3D"http://groups.yahoo.com/group/SimpleORM/join;_ylc=3DX3oDMT=
JmbnU4YXU0BF9TAzk3NDc2NTkwBGdycElkAzczNjAyMjYEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlY=
wNmdHIEc2xrA3N0bmdzBHN0aW1lAzEzMDMxMDU4Mjc-">Change settings via the Web</a=
> (Yahoo! ID required) <br>
Change settings via email: <a href=3D"mailto:SimpleORM-digest@yahoogr=
oups.com?subject=3DEmail Delivery: Digest">Switch delivery to Daily Digest<=
/a> | <a href =3D "mailto:[email protected]?subject=3D=
Change Delivery Format: Fully Featured">Switch to Fully Featured</a> <br>
<a href=3D"http://groups.yahoo.com/group/SimpleORM;_ylc=3DX3oDMT=
JkbGpmanVqBF9TAzk3NDc2NTkwBGdycElkAzczNjAyMjYEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlY=
wNmdHIEc2xrA2hwZgRzdGltZQMxMzAzMTA1ODI3">
Visit Your Group=20
</a> |
<a href=3D"http://docs.yahoo.com/info/terms/">
Yahoo! Groups Terms of Use
</a> |
<a href=3D"mailto:[email protected]?subject=3DUns=
ubscribe">
Unsubscribe=20
</a>=20
<br>
</div>
<br>
<!-- |**|end egp html banner|**| -->
<div style=3D"color: white; clear: both;"/>__,_._,___</div>
</body>
</html>
--0016368319a0c2f4f704a12af721--