Re: something not working as I expect it to
Thanks for the info. I change the default values, and am now getting: ERROR: Can not get next org.apache.ojb.broker.util.sequence.HighLowSequence for next scope of keys null in my tests... any ideas? - Brill Pappin - Original Message - From: "Lance Eason" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Monday, March 31, 2003 12:22 AM Subject: RE: something not working as I expect it to OJB looks for a value of 0. If the id value is 0 and it is set to auto-increment then OJB will generate a value for it. I ran into the same thing myself not to long ago. -Original Message- From: Brill Pappin [mailto:[EMAIL PROTECTED] Sent: Sunday, March 30, 2003 11:00 PM To: OJB Users List Subject: something not working as I expect it to I have a fairly simple object, who's ID I need to access. in my descriptor for the object, I have the id field set to auto-increment and as a primary key. In the class, the id is initialized to -1 (All my classes, in all my libraries initialize all instance members, even if only to null. this is part of our standards and good programming practice in general). What I am expecting, is that because I've set the id to auto-increment in the descriptor, that when I create a new class, the ID is auto generated... however what I get is the default value of the new object (-1 in this case). Can I force ID's for a particular object to always be generated by the database? If not, what is the recommended way to force that generation? I need the ID's because I'm working in a web environment and the id's are often called from remote applications... not to mention legacy data/apps ;) So, I need the ID field, but I also want the system to generate it for new objects. - Brill Pappin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
something not working as I expect it to
I have a fairly simple object, who's ID I need to access. in my descriptor for the object, I have the id field set to auto-increment and as a primary key. In the class, the id is initialized to -1 (All my classes, in all my libraries initialize all instance members, even if only to null. this is part of our standards and good programming practice in general). What I am expecting, is that because I've set the id to auto-increment in the descriptor, that when I create a new class, the ID is auto generated... however what I get is the default value of the new object (-1 in this case). Can I force ID's for a particular object to always be generated by the database? If not, what is the recommended way to force that generation? I need the ID's because I'm working in a web environment and the id's are often called from remote applications... not to mention legacy data/apps ;) So, I need the ID field, but I also want the system to generate it for new objects. - Brill Pappin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie questions about ojb setup with my database
I've got a similar questions about those tokens. I'm at the point of deploying the libs and a few tests to my development server, however the tests seems to be failing because the tokens are not being replaced. I assume in the following (from repository-database.xml) that those values are supposed to come from the OJB.properties file, however in my test output it looks like they are not getting parsed. I imagine this is a common problem, so can anyone tell me where the failure originates, or how to solve it? - Brill Pappin - Original Message - From: "Michael Harrison" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, March 30, 2003 6:22 PM Subject: newbie questions about ojb setup with my database > Hello, all. I'm very new to OJB, and I'm very excited about it. I've > been reading the extensive documentation at db.apache.org, and I've > managed to get OJB set up. I have a question, however, about configuring > OJB to work with my MySQL database. > > I'm not only new to OJB, but new to Ant and building (I've been in the > interpreted throw-away scripting world for a long time), so part of what > I need to learn stems from my ignorence there. After I downloaded OJB > and expanded everything, I followed the instructions at platforms.html > to set up a test database. I "switched on" the line for the MySQL > profile. I also edited the mysql.profile with the proper jdbc url info, > username, password, etc. I understood that two things were happening at > once: 1) the build process was creating the necessary OJB internal > tables, not all of which (or any necessarily?) are required; and 2) the > build process was creating and populating tables for the example > database, which simulates an actual production db. > > Here are my questions: > > When I want to use OJB to connect to my own production db, do I need to > run the build again, against a new build.xml file; or is it already set > up to use MySQL, and I only have to alter a few configuration files for > the new jdbc url, password, etc? > > The file repository_database.xml contains a jdbc-connection-descriptor > with attributes like jcd-alias="@JCD_ALIAS@" I'm not familiar with > @foo@ notation--does this mean there is supposed to be a > previously-defined value for some JCD_ALIAS token or entity? Or is this > a placeholder that I should replace with real values? > > Also, what is the relationship between the repository_database.xml file > and the values I set in mysql.profile before the build? Is the build > supposed to write this XML file out? > > If I need to rerun the build, how do I avoid creating all the example > tables? > > I apologize for the newbie questions. I'm climbing a steep learning > curve, and I'm probably not being as patient as I should be. Help me > out, and I promise I'll find much more interesting questions soon enough. > > Best Regards, > > Michael > > || > > > - > 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]
Re: new to the api and have a question
> > possible to make an object immutable... for instance, I've got a country > > list and the data doesn't change, and I want to make sure that one of my > > developers can't alter the table (particularly in the production env). > > Currently in my own design I'm using a fairly simple JavaBean system, and a > > factory behind the beans... this allows the factory to throw a veto > > exception if the data is immutable and someone tried to change it. Does > > anything like that exist in this API? > > Not on the API level. Access rights should be addressed on the DB level > (with grants). In this case, using separate users for each object that needs r/w or read only would be seriously messy. I should be able (in the object mapping) to set an immutable parameter to the system know that new existing objects can be changed. You could even extend this further with a set of "permissions" as in "allow select: disallow update, create, delete" IMO this is object level permissions, not DB permissions really, because the OBJ-DB layer still has to be able to manipulate the DB under its account (it's also much more expensive to use grant). Another related ability, is a locking ability... a kind of weak lock. so that objects did not get updated unless they where specifically "enabled" for update... I'm thinking that could be put into the object layer easily though. - Brill Pappin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: new to the api and have a question
Ah... perfect ;) That would work very similarly to my current system where I throw a veto exception on the bean properties. Just what I need... now to try and implement it ;) - Brill Pappin - Original Message - From: "Ron Gallagher" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, March 30, 2003 1:45 PM Subject: Re: new to the api and have a question > > Hello all, > > > > I'm new as of today, to this api. > > > > I sat down Friday to write one ;) and then though "someone else must have > > tried this already"... and here it is! > > > > Anyway, I'm going through the documentation now, but I wanted to know if its > > possible to make an object immutable... for instance, I've got a country > > list and the data doesn't change, and I want to make sure that one of my > > developers can't alter the table (particularly in the production env). > > Currently in my own design I'm using a fairly simple JavaBean system, and a > > factory behind the beans... this allows the factory to throw a veto > > exception if the data is immutable and someone tried to change it. Does > > anything like that exist in this API? > > Have you looked at the PersistenceBrokerListener interface? It includes a beforeStore method that's invoked before any object is persisted. When beforeStore method is invoked, you just look at the object that's being stored. If it's a 'country' objec > t, simply throw an exception and the storage opertion will be aborted. > > Ron Gallagher > Atlanta, GA > [EMAIL PROTECTED] > > > > - > 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]
new to the api and have a question
Hello all, I'm new as of today, to this api. I sat down Friday to write one ;) and then though "someone else must have tried this already"... and here it is! Anyway, I'm going through the documentation now, but I wanted to know if its possible to make an object immutable... for instance, I've got a country list and the data doesn't change, and I want to make sure that one of my developers can't alter the table (particularly in the production env). Currently in my own design I'm using a fairly simple JavaBean system, and a factory behind the beans... this allows the factory to throw a veto exception if the data is immutable and someone tried to change it. Does anything like that exist in this API? My other questions is about storing objects in the app servers memory, but I saw something about that already, so I'll wait to ask questions if I can't get the answers. Anyway, it looks fantastic, and I'm fairly excited about trying it out... I particularly like the distributed thing, as we're running a fairly large server pool. - Brill Pappin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]