schemaexport

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

社会主义新天地 提交于 2019-12-29 05:18:26
问题 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) references [Customer] I have tried adding .NotFound.Ignore() like on a References() mapping to disable the constraint from being generated but this does not work. Can a mapping be defined that will force SchemaExport to not generate the constraint? 回答1: Figured

Grails 3 schema-export in build.gradle

╄→гoц情女王★ 提交于 2019-12-24 19:22:28
问题 In Grails 2 I had a nifty gradle task that would generate DDL for me: task extractGrailsDDL(type: org.grails.gradle.plugin.tasks.GrailsTask) { command "schema-export" args ddlFileName("Temp") + " --datasouce=operator" } But that doesn't work in Grails 3, I get that, a lot has changed. The question is: How can I create a Gradle Task to run a schema export and pass file name and datasource parameters to it? 回答1: You don't need to create a Gradle task. A task already exists. http://docs.grails

Hibernate one to many mapping error - mappedBy reference an unknown target entity property error

谁说胖子不能爱 提交于 2019-12-24 06:35:56
问题 I am trying to test one to many mapping by creating tables from domain objects but I see the error mappedBy reference an unknown target entity property . Could some one take a look please? Thanks Employee.java import javax.persistence.Column; import javax.persistence.DiscriminatorColumn; import javax.persistence.DiscriminatorType; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax

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

一曲冷凌霜 提交于 2019-12-23 13:17:09
问题 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 from scratch. I'm thinking it should be possible, as grails does have the ability to actually update schemas if you specificy dbCreate = "update" in your datasource. But I just want grails to spit out what it would run, not actually do it, so I can

Suppress ORA-00942 errors in ddl create scripts

↘锁芯ラ 提交于 2019-12-11 01:53:56
问题 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 ORA-00942 errors running on an Oracle db. Since they're not really errors if the tables just didn't exist yet, I'd like my create script to be error free when it executes so it's easy to determine what (if any) failed. What are my options? I DO want drop

Which Oracle view contains all constraints together?

*爱你&永不变心* 提交于 2019-12-11 01:14:38
问题 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' WHEN 'PROCEDURE' then 'procedures' WHEN 'SEQUENCE' then 'sequences' WHEN 'TABLE' then 'tables' WHEN 'TRIGGER' then 'triggers' WHEN 'VIEW' then 'views' WHEN 'SYNONYM' then 'synonyms' WHEN 'GRANT' then 'grants' WHEN 'CONSTRAINT' then 'constraints' ELSE object_type END||'|'|| CASE

NHibernate does not create Tables

こ雲淡風輕ζ 提交于 2019-12-08 08:37:29
问题 var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof(<ClassName>).Assembly); new SchemaExport(cfg).Execute(false, true, false, false); The above piece of code is supposed to create a database Table with name <ClassName> . But it is not creating. 回答1: Your most likely problems: using SQLite with connection.release_mode=on_close no mapping files in the specified assembly mapping files have not been added to the assembly as an Embedded Resource mapping files are not named *.hbm

Foreign Keys with SchemaExport in Fluent NHibernate using SQLite

杀马特。学长 韩版系。学妹 提交于 2019-12-07 06:15:39
问题 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, foreign keys for one-to-many relationships aren't created. Here is my Equipment entity: public virtual int Id { get; set; } public virtual EquipmentType Type { get; set; } public virtual int StockId { get; set; } And here are my mappings for

NHibernate does not create Tables

南楼画角 提交于 2019-12-06 15:45:23
var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof(<ClassName>).Assembly); new SchemaExport(cfg).Execute(false, true, false, false); The above piece of code is supposed to create a database Table with name <ClassName> . But it is not creating. Your most likely problems: using SQLite with connection.release_mode=on_close no mapping files in the specified assembly mapping files have not been added to the assembly as an Embedded Resource mapping files are not named *.hbm.xml some table or column names should be quoted for SQL (this would be throwing an exception) The first

Foreign Keys with SchemaExport in Fluent NHibernate using SQLite

会有一股神秘感。 提交于 2019-12-05 12:00:32
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, foreign keys for one-to-many relationships aren't created. Here is my Equipment entity: public virtual int Id { get; set; } public virtual EquipmentType Type { get; set; } public virtual int StockId { get; set; } And here are my mappings for Equipment : Id(x => x.Id); References(x => x.Type); Map(x => x.StockId); The SQL is generated correctly, except