If you use an int then it is initialized to 0, which is saved into the database as it is a valid int =( If you want autoincrement to work you need to use the Integer (or Long) wrapper. When the pk is null, it will autoincrement.
public class IncorrectThing { public int pk; }
public class CorrentThing { public Integer pk; }
IncorrectThing it = new IncorrectThing(); CorrectThing ct = new CorrectThing();
If "it" is stored it has a valid value for it.pk --> 0 If "ct" is stored it has null for ct.pk, so will have a value assigned.
-Brian
On Feb 2, 2004, at 11:47 AM, Ralf Bode wrote:
Thanks
i am still dealing now without its internals ;-) i didnīt figured it out on page!! Thanks Brenden,!!!
one short question - then i am quiet! :-)
why must i set the PK in my code?
customer.setId(123);
i described it in XML primarykey="true" autoincrement="true"
but got Errsos, when i dont set up the PK.
thanks again for a quick ;-) advice
ralf
--- "Larry V. Streepy, Jr." <[EMAIL PROTECTED]> schrieb: > I struggled with this same problem when learning and__________________________________________________________________working with OJB. My final solution was to run the build of OJB and then setup my project build to extract the generated SQL (the schema.ddl file) and copy it into my build area and use ant sql tasks to generate the tables. I know that this creates a minor dependency between the two projects, but that's fairly easy to manage. I have no need for setting up and utilizing torque in my project (I use Axgen to generate everything from UML), so it seemed like major complications to solve a simple problem.
YMMV. Larry.
Brian McCallister wrote:
I have considered including the torque stuff inthe ojb-blank projectbefore, and opted against it as I thought I mightbe pushing too muchcomplexity on users then.internal tables as
Right now there isn't an *ideal* way to create themost of the time people don't need them (thoughthe hi/lo sequencetable is needed enough that this may be incorrect,since it is thedefault sequence manager).generator stuff in
What are thoughts on including the torqueojb-blank? The ojb-core schema is already includedin the src/schemadirectory, but the build-torque and torque relatedjars are notincluded. Now that I think about it, I have donethis for all of theprojects I have built around ojb-blank bitsanyway, so that is acertain argument in favor.walkthrough on
In the short term, Thomas D has has a nice littlegetting torque from OJB setup in the xdoclet docs,but that is sort ofhidden =) (note, we should probably move that intoits own HOWTO).
-Brian
On Feb 2, 2004, at 3:19 AM, Ralf Bode wrote:
Hi to all,
just a question about to install OJB i read, that i have to load the sources and run some build-scripts okay.
but is there an easy-way? i only need a build-script for the binary-version of OJB, that "installs" OJB-internal-tables into database.
or is there a reason for "building" all ?
thanks for advice!
greetings ralf
---------------------------------------------------------------------http://suche.yahoo.de
Gesendet von Yahoo! Mail - http://mail.yahoo.de Mit Yahoo! Suche finden Sie alles:
---------------------------------------------------------------------[EMAIL PROTECTED]To unsubscribe, e-mail:[EMAIL PROTECTED]For additional commands, e-mail:
---------------------------------------------------------------------To unsubscribe, e-mail:[EMAIL PROTECTED]For additional commands, e-mail:[EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________________________________________
Gesendet von Yahoo! Mail - http://mail.yahoo.de Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]