Have you tried with SchemaUpdate instead of SchemaExport?
(I have absolutely no idea if it works)
Diego
On Wed, Aug 4, 2010 at 20:56, Waqar Sadiq <[email protected]> wrote:
> Hi,
>
> I am using NHibernate 2.1.2 and the underlying database is Oracle. I
> am running into a problem but before explaining the problem, I want to
> explain some functionality in my application.
>
> This application allows the user to cerate a data model. For each
> entity that they create in the data model, I generate a C# class, a
> mapping file and the corresponding table in the database. Later if
> they add a new entity to the data model, its corresponding class,
> mapping files are generated and the assembly is rebuilt. All the C#
> classes and mapping files are complied into an assembly and this
> assembly is later used to initialize a hibernate session. Always, the
> table is created by creating a Configuration object that has the
> mapping for the table that needs to be created and then SchemaExporter
> is used. The following code cerates the table.
>
> //////////////////// begin code //////////////////////////
> Configuration cfg = new Configuration();
> IDictionary<string, string> properties = new Dictionary<string,
> string>();
> properties.Add("dialect", dinfo.dialect);
> properties.Add("connection.provider",
> "NHibernate.Connection.DriverConnectionProvider");
> properties.Add("connection.driver_class", dinfo.driver);
> properties.Add("connection.connection_string", db_connectionString);
> cfg.AddProperties(properties);
> cfg.AddResource("mapping name", "assembly name");
>
> SchemaExport se = new SchemaExport(cfg);
> se.SetDelimiter (";");
> se.Execute(true, true, false);
> //////////////////////////////////////////////////////////////
>
> That all works but a specific problem has surfaced.
>
> The generated mappings use the "sequence" generator for id
> generation. For some desired behavior, all entities share the same
> sequence for id. So when a new table is created, hibernate
> essentially resets the underlying sequence.
>
> Is there anyway to tell hibernate not to reset the sequence if it
> already exists?
>
> Thanks for your help.
>
> Waqar
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.