Good! didn't know that, thanks!

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Fri, Jul 24, 2009 at 3:11 PM, Nexus <[email protected]> wrote:

>
> At first do not enable debug output (i presume you enabled logging on
> NHibernate.SQL namespace) as outputting logging info allready
> consumes resources (==Time!!).
>
> Make the class with the binary data mutable=false in the mapping (so
> it behaves as a valueobject, and nh does not check for being dirty)
> and just change instance on parent(owner class) when you want to
> change binary data (maybe in mapping cascase=all-delete-orphan to
> automaticly remove the previous one).
>
> That should fix the issue you're having
>
> Kind Regards
>
>
>
> On 23 jul, 23:32, Tuna Toksoz <[email protected]> wrote:
> > I don't know but expect a solution from me soon(weekend perhaps)
> > Tuna Toksöz
> > Eternal sunshine of the open source mind.
> >
> >
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
> >
> > On Fri, Jul 24, 2009 at 12:24 AM, jc_lvngstn <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> > > Thank you, Tuna. Unfortunately, this doesn't seem to work. I tried
> > > implementing IUser in a class, and I also tried creating a class that
> > > derived from EmptyInterceptor, and using FindDirty. In both cases, the
> > > same thing happened:
> >
> > > We get debug output when nHibernate flushes. In both cases, I can see
> > > in my debug window the binary data that is being flushed...but not all
> > > at once. At first, the binary data quickly begins appearing in my
> > > debug window. Then, as more and more data from the byte[] array is
> > > being flushed, the output starts showing up slower...and
> > > slower...until minutes pass before any more byte[] data shows up in
> > > the output window.
> >
> > > I started to wonder if the column was supposed to be unique in the SQL
> > > database, and perhaps SQL was checking against all of the other binary
> > > blob values in that column for each byte (or chunk of bytes) that were
> > > written out to the table...but that's not the case.
> >
> > > Also...I can't imaging that a 300k byte check for "dirtyness" would
> > > take 15+ minutes. Could it?
> >
> > > On Jul 23, 2:12 pm, Tuna Toksoz <[email protected]> wrote:
> > > > I meant implementing IUserType.You can have a thing like
> >
> > > > class MyBinary
> > > > {
> > > >    byte[] Data{get;set}
> > > >    bool Changed{get;set;}
> >
> > > > }
> >
> > > > class MyBinaryType:IUserType//This is the type that NH will use,
> above is
> > > > its representation in the domain
> > > > {
> >
> > > > }
> >
> > > > Can't speak from the mind, without looking the code.
> >
> > > > Tuna Toksöz
> > > > Eternal sunshine of the open source mind.
> >
> > >http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitt.
> ..
> >
> > > > On Thu, Jul 23, 2009 at 10:09 PM, jc_lvngstn <
> [email protected]
> > > >wrote:
> >
> > > > > Seems like the easiest thing would be to have the ability to
> control
> > > > > when the dirty flag is set. For example, in the setter of my binary
> > > > > object, I could just set isdirty was true, and have nHibernate just
> > > > > check my own bool dirty flag.
> >
> > > > > Otherwise...I'm not sure what you mean by user type. Are you saying
> I
> > > > > should do something like this:
> >
> > > > > Thing
> > > > > {
> > > > >  public virtual Id {get;set;}
> > > > >   public virtual MyCustomBinaryData {get;set;}
> > > > > }
> >
> > > > > class MyCustomBinaryData
> > > > > {
> > > > >  byte[] Date {get;set;}
> > > > > }
> >
> > > > > thanks for your help with this!
> >
> > > > > On Jul 23, 11:50 am, Tuna Toksoz <[email protected]> wrote:
> > > > > > I know the problem: The dirty check. It has to loop all
> individual
> > > bytes.
> > > > > A
> > > > > > work around would be to use your own type.
> >
> > > > > > Tuna Toksöz
> > > > > > Eternal sunshine of the open source mind.
> >
> > > > >
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitt.
> > > ..
> >
> > > > > > On Thu, Jul 23, 2009 at 7:29 PM, jc_lvngstn <
> > > [email protected]
> > > > > >wrote:
> >
> > > > > > > I have a situation where updateing/inserting a binary object of
> > > about
> > > > > > > 300k in a sql database takes so long (20+ minutes) that I have
> to
> > > end
> > > > > > > the program. Loading the data is fairly quick, however.
> > > > > > > My classes look like this:
> >
> > > > > > > Parent
> > > > > > > {
> > > > > > >   public virtual Guid Id {get;set;}
> > > > > > >   Thing {get;set;}
> > > > > > > }
> >
> > > > > > > Thing {
> > > > > > >  public virtual Id {get;set;}
> > > > > > >  public virtual byte[] Data {get;set;}
> > > > > > > }
> >
> > > > > > > Parent.hbm.xml:
> > > > > > > Here is the xml where I declare Thing property information for
> > > Parent
> >
> > > > > > >    <many-to-one name="Thing"
> > > > > > >                 class="Thing"
> > > > > > >                 column="ThingId"
> > > > > > >                 cascade="save-update"
> > > > > > >                 lazy="proxy" />
> >
> > > > > > > In the SQL database, the Parent table contains a ThingId column
> > > with a
> > > > > > > guid that references the Id of that particular Thing in the
> Thing
> > > > > > > table, so it's really a one-to-one mapping.
> >
> > > > > > > I'm somewhat new to nHibernate, any suggestions would be very
> > > > > > > welcome.
> >
> > > > > > > Thing.hbm.xml looks like this (without the header portion)
> >
> > > > > > > <class name="Thing"
> > > > > > >         lazy="true">
> > > > > > >    <id name="Id">
> > > > > > >      <generator class="guid" />
> > > > > > >    </id>
> > > > > > >    <property name="Data" column="Data" type="BinaryBlob"
> > > > > > > length="2147483647" />
> > > > > > >  </class>- Tekst uit oorspronkelijk bericht niet weergeven -
> >
> > - Tekst uit oorspronkelijk bericht weergeven -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to