-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Property get generates invalid update statement
PostPosted: Wed Jul 25, 2007 6:45 am 
Newbie

Joined: Mon Jun 25, 2007 3:59 pm
Posts: 15
I get field value from PostgreSQL 8.2 table KLIENT.
Table has date type column kontakteer .

I got PostgreSQL error

ERROR: invalid input syntax for type date: "-infinity"
STATEMENT: UPDATE firma1.klient SET kontakteer = '-infinity' WHERE kood = 'MEISTERMAILI'

Questions:

1. How to disable update command ? I'm only reading data.

2. How to fix buggy update statement ?
-infinity is not allowed aluse for date type, null should be used instead.

Andrus.

My entity class:

Code:
namespace Business {
[Serializable, ActiveRecord("klient",DynamicUpdate=true,Lazy=true,Cache=CacheEnum.NonStrictReadWrite)]
  public class KlientEntity : ActiveRecordValidationBase<KlientEntity> {

       string kood;
       string nimi;
       DateTime kontakteer;

      [PrimaryKey(PrimaryKeyType.Identity ,"kood", Length=12)]
      public virtual string Kood
      {
         get { return kood; }
         set { kood = value; }
      }

      [Property(Column="nimi", NotNull=true, Length=80)]
      public virtual string Nimi
      {
         get { return nimi; }
         set { nimi = value; }
      }

  public static string GetNimi(string kood) {
    KlientEntity e = TryFind(kood);
    if (e == null) return String.Empty;
    return e.Nimi;
    }

   [Property(Column="kontakteer")]
   public virtual DateTime Kontakteer
   {
      get { return kontakteer; }
      set { kontakteer = value; }
   }

}
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 01, 2007 4:10 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
Re #1: How to prevent changes.

You're using ActiveRecord, so I'm not sure if this applies. In my hbm.xml files, I specify:

Code:
<class name="Foo" table="foo_table" mutable="false">


Which should prevent any DML for that object.

I'm not sure about #2. I've never used Postgre, but maybe that is the issue?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 02, 2007 10:11 am 
Newbie

Joined: Mon Jun 25, 2007 3:59 pm
Posts: 15
About 1:
I want at some time to change table.
As I know mutable disables any changes to table so this is not option.

About 2: Yes, et seems to be Nhibernate PostgreSQL driver issue.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 02, 2007 11:13 am 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
kobruleht wrote:
About 1:
I want at some time to change table.
As I know mutable disables any changes to table so this is not option.


Oh, okay....

You say you're only reading data. Then NH should not perform an update... are you sure the value of that property hasn't changed??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 02, 2007 11:27 am 
Newbie

Joined: Mon Jun 25, 2007 3:59 pm
Posts: 15
To reproduce this issue I use MS WinForms ReportViewer control from my application.
In this case it only reads data.

In some other menu selection I need to update data also.
mutable="false" seems to be global option to whole application.
So it seems to be not usable generally.

Value propery is not been changed by my code since I don't have any change command before calling ReportViewer.

PostgreSQL DATE type is mapped to POCO class DataTime type.

I call AR TryFind from ReportViewer expression.Using ReportViewer causes NH to think that column is changed.
If I use fyireporting.com report engine this issue does not occur.

MS ReportViewer runs application in separate security context. It loads all required dlls again. Maybe this causes this issue.

It is interesting that FlushAction.Never does to disable changes in this case. Maybe new NH ISession is created by some strange reason which does not inherit this setting.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.