[odb-users] Generate C++ classes from a DB

Adrien G adrien_chem at hotmail.com
Wed Jan 29 12:40:27 EST 2014


Hi Boris,
>But what happens if/when the
> schema changes? Do you regenerate the classes? Or update
> them manually?
- I would say every time the db changes the user should launch a script to get the c++ classes up to date.- For user customizations why not use a private class member embedded within the class generated which contains all the requirement to get odb working. In this way it would be easier to detect user changes and keep the odb specifics proper...- Concerning the generation itself I dont have the skills to bring any idea.. :/- What about studying how hibernate manages this issue?
Bye :)
> Date: Wed, 29 Jan 2014 17:59:27 +0200
> From: boris at codesynthesis.com
> To: adrien_chem at hotmail.com
> CC: odb-users at codesynthesis.com
> Subject: Re: [odb-users] Generate C++ classes from a DB
> 
> Hi Adrien,
> 
> Adrien G <adrien_chem at hotmail.com> writes:
> 
> > Once that said, imagine you have a db with hundred of tables, its
> > insane to code it by hand, for time and human errors reasons
> 
> Yes, that's the motivation. But what happens if/when the
> schema changes? Do you regenerate the classes? Or update
> them manually?
> 
> In other words, is this feature going to generate classes
> that are the "rough draft" and the user can fill them in
> with customization or are they only for "data access"
> (i.e., don't have anything other than accessors and
> modifiers)?
> 
> The problem with the "rough draft" approach is what
> happens when the schema changes and re-generating
> the classes will loose those customizations?
> 
> The problem with the "data access" approach is that
> there is no logic in the classes.
> 
> Then, another question is: in what form the database
> schema is passed to ODB? It can be an .sql file that
> ODB has to parse (quite complex). Alternatively, ODB
> (or, more likely, a separate tool) can query the
> database programmatically for the schema (easier but
> potentially less convenient).
> 
> 
> > Do you have a roadmap for this feature?
> 
> Essentially, we are waiting for someone who has a good use-case and
> needs this feature badly enough as to help flesh out the details
> (such as the questions above) and then commit to start using the
> early implementation.
> 
> 
> > Is there any other c++ lib which supports this ?
> 
> No, not that I am aware of.
> 
> Boris
 		 	   		  


More information about the odb-users mailing list