fluent

Is there any library to represent SQL queries as objects in Java code? [closed]

浪子不回头ぞ 提交于 2019-12-03 06:49:32
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I was wondering if there is any library that can be used to represent SQL queries as objects in Java. In the code I have plenty of static variables of type java.lang.String that are hand written SQL queries. I would be looking for library having a nice fluent API that allows me to represent the queries as objects

Fluent NHibernate join single column from another table

爷,独闯天下 提交于 2019-12-03 05:47:02
I'm using Fluent NHibernate and have two tables; Customer [ID, Name, LanguageID] Languages [ID, Description] I have a Customer entity with the following properties; ID, Name, LanguageID, Language What I would like to do is to join to the Languages table to get the language description and put it in the language property of the customer entity. I have tried using Join but I can't get it to use the LanguageID field on the customer table to join to the Languages table - it keeps wanting to use 'ID'. My mapping looks like; Table("Customers"); Not.LazyLoad(); Id(c => c.ID).GeneratedBy.Assigned();

Schema specified is not valid. Errors: The relationship was not loaded because the type is not available

╄→尐↘猪︶ㄣ 提交于 2019-12-03 05:23:10
I wish to reference the OrderAddress model twice in my Order model; once as a ShippingAddress and once as a BillingAdress . On the other side, I want my OrderAddress model to have a list of OrderAddresses . OrderAddress Model public enum AddressType { Billing, Shipping, Contact } public class OrderAddress : BaseModel { public AddressType AddressType { get; set; } public bool IsPrimary { get; set; } public string Address { get; set; } public string CityStateZip { get; set; } public string ContactName { get; set; } public string PhoneNumber { get; set; } public string FaxNumber { get; set; }

HasOne vs References Mapping Fluent NHibernate

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is the first time I am working with FluentNhibernate Mapping and facing a question of how to reference another table. Any help is appreciated: I have several tables named CD_ varname and all these contain two columns - CODE and DESCR. I have one main table called Recipient and it has, say two columns, called ALIVE and SEX, both are of type number, and they reference to the tables CD_ALIVE and CD_SEX. If Alive=1 in the Recipient, then we need to get the code and descr from CD_ALIVE table where Code=1. I have described a Codef class:

Fluent NHibernate Mapping a column against one of two columns

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm dealing with some legacy vendor code that I can't modify. I'd like to wrap the database with an abstraction layer that is easier to use. Given the following two tables, I need to create a mapping for Process.Route that will find the matching Route for a given Process, but that can be either dbo.Route.SourceProcessID or dbo.Route.DestinationProcessID: TABLE [dbo].[Route]( [RouteID] [bigint] IDENTITY(1,1) NOT NULL, [SourceProcessID] [bigint] NOT NULL, [DestinationProcessID] [bigint] NOT NULL TABLE [dbo].[Process]( [ProcessID] [bigint]

Fluent NHibernate Child collection persistence issues

匿名 (未验证) 提交于 2019-12-03 02:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following mapping classes (only the relevant part copied): public class CardTemplateMapping : ClassMap<CardTemplate> { public CardTemplateMapping() { Table("cardtemplate"); Id(x => x.Id) .Column("id") .GeneratedBy.Native(); HasMany(x => x.CostStructures) .KeyColumn("cardtemplate_id") .Cascade.All(); } } public class CostStructureMapping : ClassMap<CostStructure> { public CostStructureMapping() { Table("coststructure"); Id(x => x.Id) .Column("id") .GeneratedBy.Native(); References(x => x.CardTemplate) .Column("cardtemplate_id");

Fluent NHibernate one-to-one doesn&#039;t have cascade all-delete-orphan

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am in the process of updating the existing *.hbm.xml files into fluent ClassMaps and have stumbled on a mistake in our mapping files, and I don't know the default behavior for me to map this correctly. The mapping file has: <one-to-one name="LineItemAssembly" class="LineItemAssembly" cascade="all-delete-orphan" /> When using Fluent, I would expect this to map to: HasOne<LineItemAssembly>(x => x.LineItemAssembly) .Cascade.AllDeleteOrphan(); However, AllDeleteOrphan() is not an option off of Cascade (and correctly so). I understand that is

How to use the MvvmCross fluent API to bind a RecyclerView item&#039;s TextView to a property of its ViewModel on Android?

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using MvvmCross in my Xamarin Android project. I have an MvxActivity with an MvxRecyclerView , that I have assigned an item template in its layout file. <MvxRecyclerView android:id="@+id/my_recycler_view" local:MvxItemTemplate="@layout/item_recycler_view" /> The ViewModel is quite simple, it consists just of one property that holds the data to display in the RecyclerView : public class MainViewModel : MvxViewModel { private IEnumerable<ViewModelItem> _viewModelItems; public IEnumerable<ViewModelItem> ViewModelItems { get { return

Fluent Nhibernate Schema Generation

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been playing about with FluentNhibernate as part of the S#arp Architecture. Below is an example mapping. public class EventBaseMap : ClassMap<EventBase> { public EventBaseMap() { WithTable("Event_Header"); //NotLazyLoaded(); Id(x => x.Id).WithUnsavedValue(-1).GeneratedBy.Native(); Map(x => x.Name).WithLengthOf(50).Not.Nullable(); Map(x => x.Description).WithLengthOf(255); Map(x => x.Rating); Map(x => x.Price); Map(x => x.PhoneNumber).WithLengthOf(20).Not.Nullable(); Map(x => x.EmailAddress); Map(x => x.Website); Map(x => x.State).Not

Multitenancy with Fluent nHibernate and Ninject. One Database per Tenant

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm building a multi-tenant web application where for security concerns, we need to have one instance of the database per tenant. So I have a MainDB for authentication and many ClientDB for application data. I am using Asp.net MVC with Ninject and Fluent nHibernate. I have already setup my SessionFactory/Session/Repositories using Ninject and Fluent nHibernate in a Ninject Module at the start of the application. My sessions are PerRequestScope, as are repositories. My problem is now I need to instanciate a SessionFactory