Re: -s- LIKELY SPAM SGeneratorUUID added
anthony berglas <[email protected]> Wed, 2 Oct 2013 08:55:17 +1000
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Message-ID | <CA+_PZMcQHhZDxporZUfD3jFrDuJmRH0y=C7QKuY_=jXLxbZwJQ@mail.gmail.com> |
--089e012953ac1d1b2404e7b5db42 Content-Type: text/plain; charset=ISO-8859-1 Well done. Sequences are indeed a bad way to go inter database. But UUIDs are ugly. One nice alternative is to prefix the sequence with a short db name that generated them. Then you do not have the collision problem, and you have legible keys. Of course, do not introduce surrogate keys where good natural keys are available. An evil practice that has become very common. Anthony On Wed, Oct 2, 2013 at 2:43 AM, Franck Routier <[email protected]>wrote: > Hi all, > > I just added a new SGeneratorMode and SGeneratorUUID. > The purpose is to have a pk generated as a version 4 pseudo-random UUID. > This can be convinient if your record instances don't have a natural > primary key, and you want to move them from one database instance to > another. > > With sequence, this can be cumbersome, especially if other records hold > references to thoses sequences, as sequences tend to collide... > UUID give you a unique id, independant of the database instance, at the > price of a quite long primary key (32 to 36 characters, depending on wether > you keep dashes in your key or not). > > This approach is used for example in OpenBravo ERP, and is now available > in Simpleorm :-) > > Regards, > > Franck > > > -- Dr Anthony Berglas, [email protected] Mobile: +61 4 4838 8874 Just because it is possible to push twigs along the ground with ones nose does not necessarily mean that that is the best way to collect firewood. --089e012953ac1d1b2404e7b5db42 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> <div dir=3D"ltr">Well done. =A0Sequences are indeed a bad way to go inter d= atabase. =A0But UUIDs are ugly.<div><br></div><div>One nice alternative is = to prefix the sequence with a short db name that generated them. =A0Then yo= u do not have the collision problem, and you have legible keys.</div> <div><br></div><div>Of course, do not introduce surrogate keys where good n= atural keys are available. =A0An evil practice that has become very common.= </div><div><br></div><div>Anthony</div></div><div class=3D"gmail_extra"><br= > <br><div class=3D"gmail_quote">On Wed, Oct 2, 2013 at 2:43 AM, Franck Routi= er <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a>></span> wrote:<br><blockquote c= lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;= padding-left:1ex"> Hi all,<br> <br> I just added a new SGeneratorMode and SGeneratorUUID.<br> The purpose is to have a pk generated as a version 4 pseudo-random UUID.<br= > This can be convinient if your record instances don't have a natural pr= imary key, and you want to move them from one database instance to another.= <br> <br> With sequence, this can be cumbersome, especially if other records hold ref= erences to thoses sequences, as sequences tend to collide...<br> UUID give you a unique id, independant of the database instance, at the pri= ce of a quite long primary key (32 to 36 characters, depending on wether yo= u keep dashes in your key or not).<br> <br> This approach is used for example in OpenBravo ERP, and is now available in= Simpleorm :-)<br> <br> Regards,<br> <br> Franck<br> <br> <br> </blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><p> </p><p>Dr Anthony Berglas, <a href=3D"mailto:[email protected]" target=3D= "_blank">[email protected]</a>=A0=A0=A0=A0=A0=A0 Mobile: +61 4 4838 8874<= br> Just because it is possible to push twigs along the ground with ones nose<b= r> does not necessarily mean that that is the best way to collect firewood.</p= > </div> <!-- |**|begin egp html banner|**| --> <br> <br> <!-- |**|end egp html banner|**| --> <div width=3D"1" style=3D"color: white; clear: both;"/>__._,_.___</div> =20=20=20=20=20=20 =20=20=20=20=20=20 <!-- Start Recommendations --> <!-- End Recommendations --> <!-- |**|begin egp html banner|**| --> <img src=3D"http://geo.yahoo.com/serv?s=3D97476590/grpId=3D7360226/grpspI= d=3D1705006905/msgId=3D2094/stime=3D1380668175" 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= JmaGp2bjRuBF9TAzk3NDc2NTkwBGdycElkAzczNjAyMjYEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlY= wNmdHIEc2xrA3N0bmdzBHN0aW1lAzEzODA2NjgxNzU-">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= JkNGVwbWFwBF9TAzk3NDc2NTkwBGdycElkAzczNjAyMjYEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlY= wNmdHIEc2xrA2hwZgRzdGltZQMxMzgwNjY4MTc1"> Visit Your Group=20 </a> | <a href=3D"http://info.yahoo.com/legal/us/yahoo/utos/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> --089e012953ac1d1b2404e7b5db42--