Questions tagged [schemaexport]

50 questions
14
votes
1 answer

Prevent Nhibernate schemaexport from generating foreign key constraints on has many relationship

I have a mapping like this: HasMany(x => x.Orders).KeyColumn("CustomerID"); Which is causing a constraint like this to be generated by schemaexport: alter table [CustomerOrder] add constraint FK45B3FB85AF01218D foreign key (CustomerID) …
13
votes
4 answers

Setting string to be sql type of "varchar" instead of "nvarchar"

I have the following mapping: public class LogEntryMap { public LogEntryMap() { Map.Id(x => x.Id).GeneratedBy.Identity(); Map(x => x.Context).CustomSqlType("varchar").Length(512); } } However, using SchemaExport to…
Ted
  • 7,122
  • 9
  • 50
  • 76
9
votes
5 answers

Can NHibernate check if the db schema has been generated?

So, newbie NHibernate user; trying to wrap my brain around it. I'm contemplating how to handle deployment, and later injection of add-ons to a web app (which may require their own persistence classes). I was thinking that using SchemaExport for the…
Paul
  • 35,689
  • 11
  • 93
  • 122
7
votes
2 answers

Syntax Error in SQL Statement with H2

I have an error while some sql statements in H2 database. Those sql statements come from a Hibernate SchemaExport : Here are the sql statements : create table CONTACTS ( person_id bigint not null, contact_id bigint not null, primary…
Dimitri
  • 8,122
  • 19
  • 71
  • 128
5
votes
3 answers

NHibernate SchemaExport: How to generate a meaningful unique key name?

When I use SchemaExport with SQL Server 2005, it generates unique key names like: UQ__Employees__03317E3D How can I generate a name like: UQ__Employees__Name? Even in SQL Server!
ldp615
  • 932
  • 1
  • 9
  • 13
5
votes
1 answer

Foreign Keys with SchemaExport in Fluent NHibernate using SQLite

I am attempting to create a simple database application which keeps track of loans of various types of equipment using Fluent NHibernate and SQLite. However, when I try to generate the database structure with SchemaExport for use in unit testing,…
user153498
5
votes
2 answers

Fluent NHibernate ExportSchema without connection string

I want to generate a database script without having an actual database connection string declared. To do this for now i use NHibernate ExportSchema bases on a NHibernate configuration generated with Fluent NHibernate this way (during my…
Vince
  • 1,036
  • 1
  • 10
  • 17
4
votes
1 answer

Can Grails 2.x schema-export, or similar command, generate DDL for schema updates given a datasource?

Grails schema-export does a great job of generating the DDL to create database schemas for a particular database. However what I would like to do, is have grails just output the DDL for updates to an already created schema, not the DDL to create it…
Peter
  • 29,498
  • 21
  • 89
  • 122
3
votes
1 answer

Fluent NHibernate AutoMapping SchemaExport - Change object model and Keeping Data

Is there a way for the fluent automapping to alter a schema when the data object model changes (adding a new property to a class), currently it only drops and recreates the database schema, which would lose all the data in the database. Can it use…
3
votes
1 answer

NHibernate SchemaExport and Configure() catch-22

I want to use DDD in a new project and model my classes first, then generate the database schema based on the class library. My plan is to do this with the NHibernate hbm2ddl tool SchemaExport. The problem is that I can't get the SchemaExport to…
Asbjørn Ulsberg
  • 8,721
  • 3
  • 45
  • 61
2
votes
1 answer

SchemaExport, NHibernate and deleting foreign keys

I am building my mapping and then using schema export to update my DB. However, if I delete an association in my mapping, since it's no longer in the mapping, when I run SchemaExport, it will not delete the foreign key for the deleted association.…
pondermatic
  • 6,453
  • 10
  • 48
  • 63
2
votes
2 answers

How to test generate tables with fluent nhibernate (schemaexport)? in asp.net context

well this is my very very first project with fluent hibernate.i've had small experience in hibernate and nhibernate. This context is completely new to me since this is a web app project. So i have my webapp project with most of the fluent nhibernate…
black sensei
  • 6,528
  • 22
  • 109
  • 188
2
votes
2 answers

Suppress ORA-00942 errors in ddl create scripts

Say you generate ddl to create all your db tables etc via Hibernate SchemaExport etc. What you get is a script which starts with drop statements at the beginning. Not a problem, as I want this. But running this script produces a crapload of…
Manius
  • 3,594
  • 3
  • 34
  • 44
2
votes
2 answers

Which Oracle view contains all constraints together?

I'm trying to get CONSTRAINTS from user_objects table like this: select CASE object_type WHEN 'DATABASE LINK' then 'dblinks' WHEN 'FUNCTION' then 'functions' WHEN 'INDEX' then 'indexes' WHEN 'PACKAGE' then 'packages' …
Ronaldus
  • 29
  • 2
  • 7
2
votes
1 answer

NHibernate SchemaExport does not create ntext columns

I create a simple tool which uses SchemaExport to generate database & sql scripts. On a simple entity, one string property Description is expected a ntext column in SQL Server but infact it is nvarchar(255). Do not sure that which part I was wrong,…
hazjack
  • 1,645
  • 13
  • 27
1
2 3 4