I have CustomDBContext:
public class CustomDBContext : DbContext
{
public CustomDBContext(string connectionString)
: base(connectionString)
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
......
modelBuilder.Entity<KeyProd>().ToTable("KeyProd");
......
}
}
And Repository registration in Startup.cs:
.....
var builder = new ContainerBuilder();
builder.Register(c => RepositoryFactory.GetInstance<KeyProd, long>("ef")).As<IRepository<KeyProd, long>>().InstancePerRequest();
After injection of this repository to my service, i try to add new row to database:
_keyProductionRepository.Add(new KeyProd
{
Id = key.Id,
Comment = key.Comment,
CreatedBy = adminId,
DateCreated = DateTime.UtcNow,
KeyType = key.KeyType,
PageId = key.PageId,
Name = key.Name
});
The exception is:
Cannot insert the value NULL into column 'Id', table 'ln_resources.dbo.KeyProd'; column does not allow nulls. INSERT fails.\r\nThe statement has been terminated.
The model i try to insert have id (3). Is not null.I checked it in debug mode.
My table in SQl without autoincremented Id. This is a query of table:
CREATE TABLE [dbo].[KeyProd](
[Id] [bigint] NOT NULL,
[Name] [nvarchar](100) NULL,
[KeyType] [int] NOT NULL,
[Comment] [text] NULL,
[PageId] [int] NOT NULL,
[CreatedBy] [int] NOT NULL,
[DateCreated] [datetime] NOT NULL DEFAULT (getdate()),
[DateUpdated] [datetime] NULL DEFAULT (getdate()),
[UpdatedBy] [int] NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
GO
ALTER TABLE [dbo].[KeyProd] WITH CHECK ADD CONSTRAINT [FK_KeyProd_Page] FOREIGN KEY([PageId])
REFERENCES [dbo].[Page] ([Id])
GO
ALTER TABLE [dbo].[KeyProd] CHECK CONSTRAINT [FK_KeyProd_Page]
GO
My KeyProd Class:
public class KeyProd
{
public long Id { get; set; }
public string Name { get; set; }
public KeyType KeyType { get; set; }
public string Comment { get; set; }
public int PageId { get; set; }
public int CreatedBy { get; set; }
public DateTime DateCreated { get; set; }
public int? UpdatedBy { get; set; }
public DateTime? DateUpdated { get; set; }
}
If i try to insert this model directly from SQL SERVER by using SQL INSERT, all works fine.
Where the problem? Why Id is Null? Why mapping not working.
You may need to annotate the key field on KeyProd to indicate that you don't want the value to be automatically generated by your context. Try adding DatabaseGeneratedOption.None to your key property.
public class KeyProd {
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public long Id { get; set; }
// ... Other properties
}
Related
I am using EF Core Database First Approach, where I have a one to many relationship in two tables.
visit and expense_details table.
Here one visit may have zero or multiple entry in expense_details table
I defined foreign key relationship between those, but, when I run the project the resulted JSON returns NULL for Visit property in Expense_details object and same happens in case of expense property in Visit Object.
My Database Objects are:
CREATE TABLE [dbo].[visit](
[id] [int] IDENTITY(1,1) NOT NULL,
[user_id] [int] NOT NULL,
[tour_id] [int] NULL,
[description] [varchar](200) NULL,
[subject_to] [varchar](50) NOT NULL,
[start_date] [date] NOT NULL,
[start_time] [varchar](50) NOT NULL,
[end_time] [varchar](50) NULL,
[start_location] [varchar](50) NULL,
[destination_location] [varchar](50) NOT NULL,
[start_mileage] [decimal](18, 0) NOT NULL,
[end_mileage] [decimal](18, 0) NOT NULL,
CONSTRAINT [PK_visit] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[expense_details](
[id] [int] IDENTITY(1,1) NOT NULL,
[visit_id] [int] NOT NULL,
[expense_category_id] [int] NOT NULL,
[expense_amount] [numeric](18, 0) NOT NULL,
[remarks] [varchar](200) NULL,
CONSTRAINT [PK_expense_details] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[expense_details] WITH CHECK ADD CONSTRAINT [FK_expense_details_visit] FOREIGN KEY([visit_id])
REFERENCES [dbo].[visit] ([id])
GO
ALTER TABLE [dbo].[expense_details] CHECK CONSTRAINT [FK_expense_details_visit]
GO
These are the generated Model class after scaffolding db
public partial class Visit
{
public Visit()
{
ExpenseDetails = new HashSet<ExpenseDetail>();
}
public int Id { get; set; }
public int UserId { get; set; }
public int? TourId { get; set; }
public string Description { get; set; }
public string SubjectTo { get; set; }
public DateTime StartDate { get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
public string StartLocation { get; set; }
public string DestinationLocation { get; set; }
public decimal StartMileage { get; set; }
public decimal EndMileage { get; set; }
public virtual ICollection<ExpenseDetail> ExpenseDetails { get; set; }
}
}
public partial class ExpenseDetail
{
public int Id { get; set; }
public int VisitId { get; set; }
public int ExpenseCategoryId { get; set; }
public decimal ExpenseAmount { get; set; }
public string Remarks { get; set; }
public virtual Visit Visit { get; set; }
}
}
ModelBuilder objects are:
modelBuilder.Entity<ExpenseDetail>(entity =>
{
entity.ToTable("expense_details");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.ExpenseAmount)
.HasColumnType("numeric(18, 0)")
.HasColumnName("expense_amount");
entity.Property(e => e.ExpenseCategoryId).HasColumnName("expense_category_id");
entity.Property(e => e.Remarks)
.HasMaxLength(200)
.IsUnicode(false)
.HasColumnName("remarks");
entity.Property(e => e.VisitId).HasColumnName("visit_id");
entity.HasOne(d => d.Visit)
.WithMany(p => p.ExpenseDetails)
.HasForeignKey(d => d.VisitId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_expense_details_visit");
});
[HttpGet]
public IEnumerable<Visit> Get()
{
var visit = tourActivityExpenseContext.Visits
.Include(e => e.ExpenseDetails)
.ToList();
return visit;
}
I am not sure if I need to manually impose something in code?
I have a table named Company
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Companies](
[Id] [uniqueidentifier] NOT NULL,
[ActiveStatus] [nvarchar](max) NULL,
[Name] [nvarchar](max) NULL,
[Address] [nvarchar](max) NULL,
[Phone1] [nvarchar](max) NULL,
[Phone2] [nvarchar](max) NULL,
[Email] [nvarchar](max) NULL,
[CompanyId] [uniqueidentifier] NOT NULL,
[IsParent] [nvarchar](max) NULL,
CONSTRAINT [PK_Companies] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Companies] WITH CHECK ADD CONSTRAINT [FK_Companies_Companies_CompanyId] FOREIGN KEY([CompanyId])
REFERENCES [dbo].[Companies] ([Id])
GO
ALTER TABLE [dbo].[Companies] CHECK CONSTRAINT [FK_Companies_Companies_CompanyId]
GO
I made this using ASP.NET Core code first, this is my class
public class BaseClass
{
[Key]
public Guid Id { get; set; }
public string ActiveStatus { get; set; }
}
public class Company: BaseClass
{
public string Name { get; set; }
public string Address { get; set; }
public string Phone1 { get; set; }
public string Phone2 { get; set; }
public string Email { get; set; }
[ForeignKey("Company")]
public Guid CompanyId { get; set; }
public Company ParentCompany { get; set; }
public string IsParent { get; set; }
public ICollection<Company> ParentCompanies { get; set; }
public ICollection<Activity> Activities { get; set; }
public ICollection<Order> Orders { get; set; }
public ICollection<Ticket> Tickets { get; set; }
public ICollection<User> Users { get; set; }
}
I want to insert data to my table using a query
INSERT [dbo].[Companies] ([Id], [ActiveStatus], [Name], [Address], [Phone1], [Phone2], [Email], [CompanyId], [IsParent]) VALUES (N'af85a23c-3832-47c9-3efe-08d79f1b5659', N'Active', N'PT. Sari Coffee Indonesia', N'Sahid Sudirman Center 27th Floor, Jl. Jend. Sudirman No.Kav. 86, RT.10/RW.11, Karet Tengsin, Kota Jakarta Pusat, Daerah Khusus Ibukota Jakarta 10220', N'+62 21 574 6501', N'+62 21 574 5808', N'feedback#starbucks.co.id', N'00000000-0000-0000-0000-000000000000', N'1')
GO
But I got an error:
Msg 547, Level 16, State 0, Line 3 The INSERT statement conflicted
with the FOREIGN KEY SAME TABLE constraint
"FK_Companies_Companies_CompanyId". The conflict occurred in database
"CRMandOMS", table "dbo.Companies", column 'Id'. The statement has
been terminated.
Please help
You wanna add 00000000-0000-0000-0000-000000000000 as a CompanyId, so you faced with this error occurs because in your table there is no company with this Id.
In your scenario there is a possibility of having a company with no parent, so your table design is wrong. for resolving this error you have to make the CompanyId foreign key nullable.
do like below:
...
[ForeignKey("Company")]
public Guid? CompanyId { get; set; }
...
Then Add-Migration and Update-Database for changing the database. Now, you can insert a company with Null parent.
good luck
I'm trying to use ASP.NET Core to read from a SQL database. I'm using Microsoft.EntityFrameworkCore.DbContext and I have it working except for any tables that have an XML column
When try and read from one of these tables I get the following error:
System.InvalidOperationException
HResult=0x80131509
Message=The entity type 'SqlXml' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'.
I know this isn't talking about my model as it does have a primary key. It seems to be talking about the SqlXml class.
How can I construct a data model to bind to a SQL table with an XML column?
The DBContext
public class HistoryContext : DbContext
{
public HistoryContext(DbContextOptions<HistoryContext> options) : base(options)
{
}
public DbSet<ShWorkflowRunsModel> shWorkflowRuns { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ShWorkflowRunsModel>().ToTable("sh_workflowRuns");
}
}
The Model
public class ShWorkflowRunsModel
{
[Key]
public Int64 runId { get; set; }
public Guid serviceId { get; set; }
public string serviceName { get; set; }
public Guid workflowId { get; set; }
public SqlXml workflowConfig { get; set; }
public DateTime startTime { get; set; }
public DateTime endTime { get; set; }
public bool isScheduled { get; set; }
public string errorMessage { get; set; }
public bool hasErrorCounters { get; set; }
}
The Controller
public class WorkflowController : Controller
{
private HistoryContext _context;
public WorkflowController(HistoryContext context)
{
_context = context;
}
public IActionResult History(string workflowId)
{
List<ShWorkflowRunsModel> model = GetShWorkflowRuns(workflowId);
return View(model);
}
public List<ShWorkflowRunsModel> GetShWorkflowRuns(string workflowId)
{
return _context.shWorkflowRuns.Where(wr => wr.workflowId.ToString() == workflowId).ToList();
}
}
}
The SQL table definition
CREATE TABLE [dbo].[sh_workflowRuns](
[runId] [bigint] IDENTITY(1,1) NOT NULL,
[serviceId] [uniqueidentifier] NOT NULL,
[serviceName] [nvarchar](1024) NULL,
[workflowId] [uniqueidentifier] NOT NULL,
[workflowConfig] [xml] NOT NULL,
[startTime] [datetime] NULL,
[endTime] [datetime] NULL,
[isScheduled] [bit] NULL,
[errorMessage] [nvarchar](1024) NULL,
[hasErrorCounters] [bit] NULL,
CONSTRAINT [PK_sh_workflowRuns] PRIMARY KEY CLUSTERED
(
[runId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Please let me know if you need more information
You get this error message because EF Core thinks that SqlXml is one of your entities and tries to map it to a DB table, and obviously it can't find any Id on the SqlXml class.
I don't think that that current version of EF Core has native support XML. You have to read and write it as string, and you can create a wrapper like they do it in these examples:
XML columns in a Code-First application
Does Entity Framework 6.1 support an XML data type natively?
https://social.msdn.microsoft.com/Forums/en-US/a2e6aa49-f573-4dca-a1e7-505841c3c668/entity-framework-treats-xml-type-in-sql-server-as-a-string?forum=adodotnetentityframework
I couldn't make it work, I added the data annotation for a computed field using ServiceStack ormlite Sql server:
[Compute, Ignore]
public string FullName { get; set; }
The problem is that my LoadSelect<Employee>() method doesn't load the colunm FullName from a computed field. Why?
if I remove the [Ignore] it loads, but then when I use the.create() method to create a new record, it returns an error, probably because it tries to add a value for the FullName field.
Table
CREATE TABLE [dbo].[Employee](
[EmployeeId] [int] IDENTITY(1,1) NOT NULL,
[FullName] AS (concat(ltrim(rtrim([FirstName])),' ',ltrim(rtrim([LastName])))) PERSISTED NOT NULL,
[FirstName] [nvarchar](55) NOT NULL,
[LastName] [nvarchar](55) NULL,
[Username] [nvarchar](55) NOT NULL,
[Password] [nvarchar](55) NULL
CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED
(
[EmployeeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]
Employee class:
[Schema("dbo")]
[Alias("Employee")]
public class Employee : IHasId<int>
{
[PrimaryKey]
[Alias("EmployeeId")]
[AutoIncrement]
[Index(Unique = true)]
public int Id { get; set;}
[Required]
public string FirstName { get; set; }
public string LastName { get; set; }
[Required]
[Index(true)]
public string Username { get; set; }
public string Password { get; set; }
[Compute, Ignore]
public string FullName { get; set; }
}
Get method:
public virtual async Task<IEnumerable<T>> Get<T>() where T : IHasId<int>
{
using (var dbCon = DbConnectionFactory.OpenDbConnection())
{
return await dbCon.LoadSelectAsync<T>(x => x);
}
}
Create method:
public virtual async Task<T> Create<T>(T obj) where T: IHasId<int>
{
using (var dbCon = DbConnectionFactory.OpenDbConnection())
{
// if there is an id then INSERTS otherwise UPDATES
var id = obj.GetId().SafeToLong();
if (id > 0)
dbCon.Update(obj);
else
id = dbCon.Insert(obj, true);
// returns the object inserted or updated
return await dbCon.LoadSingleByIdAsync<T>(id);
}
}
The [Ignore] attribute tells OrmLite you want it to ignore the property completely which is not what you want, you need to just use the [Compute] attribute to handle computed columns which I've just added a test for in this commit which is working as expected in the latest version of OrmLite, e.g:
db.DropTable<Employee>();
db.ExecuteSql(#"
CREATE TABLE [dbo].[Employee](
[EmployeeId] [int] IDENTITY(1,1) NOT NULL,
[FullName] AS (concat(ltrim(rtrim([FirstName])),' ',ltrim(rtrim([LastName])))) PERSISTED NOT NULL,
[FirstName] [nvarchar](55) NOT NULL,
[LastName] [nvarchar](55) NULL,
[Username] [nvarchar](55) NOT NULL,
[Password] [nvarchar](55) NULL
CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED ([EmployeeId] ASC)");
var item = new Employee
{
FirstName = "FirstName",
LastName = "LastName",
Username = "Username",
Password = "Password",
FullName = "Should be ignored",
};
var id = db.Insert(item, selectIdentity: true);
var row = db.LoadSingleById<ComputeTest>(id);
Assert.That(row.FirstName, Is.EqualTo("FirstName"));
Assert.That(row.FullName, Is.EqualTo("FirstName LastName"));
row.LastName = "Updated LastName";
db.Update(row);
row = db.LoadSingleById<ComputeTest>(id);
Assert.That(row.FirstName, Is.EqualTo("FirstName"));
Assert.That(row.FullName, Is.EqualTo("FirstName Updated LastName"));
Which also works using the async API's in your Create() helper method, e.g:
var row = await Create(item);
Assert.That(row.FirstName, Is.EqualTo("FirstName"));
Assert.That(row.FullName, Is.EqualTo("FirstName LastName"));
row.LastName = "Updated LastName";
row = await Create(row);
Assert.That(row.FirstName, Is.EqualTo("FirstName"));
Assert.That(row.FullName, Is.EqualTo("FirstName Updated LastName"));
I'm assuming you're using an older version of OrmLite, if you upgrade to the latest version it should work.
I'm having a problem with ServiceStack OrmLite for SQL Server in a Visual Studio 2013 C# project. My problem is that I'm trying to use the SqlExpression builder and it's not capturing my table schema and the generated SQL code is not correct. When I run the code, I get a System.Data.SqlClient.SqlException that says "Invalid object name 'ReportPages'."
I'm using the latest NuGet version of ServiceStack.OrmLite, which is version 4.0.24.
Let me start with the table setup. Note that I removed the foreign keys for convenience:
-- Create the report pages table.
CREATE TABLE [MicroSite].[ReportPages](
[ReportPageID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](200) NULL,
[Template] [nvarchar](50) NULL,
[AccessLevel] [int] NOT NULL,
[AssignedEmployeeId] [int] NOT NULL,
[Disabled] [bit] NOT NULL,
[Deleted] [bit] NOT NULL,
[ReportSectionID] [int] NOT NULL,
[Index] [int] NOT NULL,
[Cover] [bit] NOT NULL,
CONSTRAINT [PK_dbo.ReportSections] PRIMARY KEY CLUSTERED
(
[ReportPageID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
-- Create the report sections table.
CREATE TABLE [MicroSite].[ReportSections](
[ReportSectionID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](100) NULL,
[ReportID] [int] NOT NULL,
CONSTRAINT [PK_dbo.ReportSectionGroups] PRIMARY KEY CLUSTERED
(
[ReportSectionID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
-- Create the report editables table.
CREATE TABLE [MicroSite].[Editables](
[EditableID] [int] IDENTITY(1,1) NOT NULL,
[Index] [int] NOT NULL,
[Content] [nvarchar](max) NULL,
[Styles] [nvarchar](100) NULL,
[Type] [int] NOT NULL,
[ReportPageID] [int] NOT NULL,
CONSTRAINT [PK_dbo.Editables] PRIMARY KEY CLUSTERED
(
[EditableID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
So my tables basically look like this:
Here are my POCOs:
[Alias("ReportPages")]
[Schema("MicroSite")]
public partial class MicrositeReportPage : IHasId<int>
{
[Required]
public int AccessLevel { get; set; }
[Required]
public int AssignedEmployeeId { get; set; }
[Required]
public bool Cover { get; set; }
[Required]
public bool Deleted { get; set; }
[Required]
public bool Disabled { get; set; }
[Alias("ReportPageID")]
[AutoIncrement]
[PrimaryKey]
public int Id { get; set; }
[Required]
public int Index { get; set; }
public string Name { get; set; }
[Alias("ReportSectionID")]
[Required]
public int ReportSectionId { get; set; }
public string Template { get; set; }
}
[Alias("ReportSections")]
[Schema("MicroSite")]
public class MicrositeReportSection : IHasId<int>
{
[Alias("ReportSectionID")]
[AutoIncrement]
[PrimaryKey]
public int Id { get; set; }
public string Name { get; set; }
[Alias("ReportID")]
[Required]
public int ReportId { get; set; }
}
[Alias("Editables")]
[Schema("MicroSite")]
public partial class MicrositeEditable : IHasId<int>
{
public string Content { get; set; }
[Alias("EditableID")]
[AutoIncrement]
[PrimaryKey]
public int Id { get; set; }
[Required]
public int Index { get; set; }
[Alias("ReportPageID")]
[Required]
public int ReportPageId { get; set; }
public string Styles { get; set; }
[Alias("Type")]
[Required]
public int TypeId { get; set; }
}
The actual SQL statement I want to generate is this:
SELECT e.EditableID
, e.[Index]
, e.Content
, e.Styles
, e.Type
, e.ReportPageID
FROM
MicroSite.ReportSections AS rs
LEFT JOIN
MicroSite.ReportPages AS rp ON rp.ReportSectionID = rs.ReportSectionID AND rp.[Index] = 24
LEFT JOIN
MicroSite.Editables AS e ON e.ReportPageID = rp.ReportPageID
WHERE
rs.ReportID = 15
Here is my C# code:
var query = db.From<MicrositeReportSection>()
.LeftJoin<MicrositeReportSection, MicrositeReportPage>((section, page) => section.Id == page.ReportSectionId)
.LeftJoin<MicrositeReportPage, MicrositeEditable>((page, editable) => page.Id == editable.ReportPageId && page.Index == 24)
.Where<MicrositeReportSection>(section => section.ReportId == 15);
var sql = query.ToSelectStatement();
var result = db.Select<MicrositeEditable>(query)
The generated SQL statement from the sql variable looks like this (I formatted it for readability):
SELECT
"ReportSectionID",
"Name",
"ReportID"
FROM
"MicroSite"."ReportSections"
LEFT JOIN
"ReportPages" ON ("ReportSections"."ReportSectionID" = "ReportPages"."ReportSectionID")
LEFT JOIN "Editables"
ON (("ReportPages"."ReportPageID" = "Editables"."ReportPageID") AND ("ReportPages"."Index" = 24))
WHERE
("ReportSections"."ReportID" = 15)
First, the left joins are missing the schema name, which makes the SQL statement incorrect. Second, what's going on in the select statement? Those aren't the columns from the MicrositeEditable table. Am I doing this correctly or is this an actual bug with OrmLite?
I submitted a ticket with the development team and this is now fixed in version 4.0.25.