1

I'm not sure how to explain this. So here goes...

I'm trying to fit the method for lazy loading blobs as described here but I'm stuck with only one table.

I have a schema (fixed, in a legacy system) which looks something like this:

MyTable
   ID int
   Name char(50)
   image byte

This is on Informix, and the byte column is a simple large object. Now normally I would query the table with "SELECT ID, Name, (image is not null) as imageexists..." and handle the blob load later.

I can construct my object model to have two different classes (and thus two different map definitions) to handle the relationship, but how can I "fool" nhibernate into using the same table to show this one-to-one relationship?

1 Answer 1

2

Short answer: you can't.

You either need to map it twice or (my preference) create a DTO that has the fields you want. In HQL you'd do something like:

select new MyTableDTO(t.ID, t.name) from MyTable t
Sign up to request clarification or add additional context in comments.

1 Comment

I'm not sure I understand the Data Transfer Object idea. I'll try to apply the idea from the hibernatingrhinos post and map to the same table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.