Search Results

Search found 2 results on 1 pages for 'kunjan'.

Page 1/1 | 1 

  • what's the alternative to readonlycollection when using lazy="extra"?

    - by Kunjan
    I am trying to use lazy="extra" for the child collection of Trades I have on my Client object. The trades is an Iset<Trade Trades, exposed as ReadOnlyCollection<Trade because I do not want anyone to modify the collection directly. As a result, I have added AddTrade and RemoveTrade methods. Now I have a Client Search page where I need to show the Trade Count. and on the Client details page I have a tab where I need to show all the trades for the Client in paged gridview. What I want to achieve is, for the search when I say on the client object as client.Trades.Count, nHibernate should only fire a select count(*) query. Hence I am using lazy="extra". But because I am using a ReadOnlyCollection, nHibernate fires a count query & a separate query to load the child collection trades completely. Also, I cannot include the Trades in my initial search request as this would disturb the paging because a counterparty can have n trades which would result in n rows, when I am searching clients only. So the child collections have to be loaded lazily. The second problem is that on the client details page -- Trades grid view, I have enabled paging for performance reasons. But by nature nHibernate loads the entire collection of trades as the user goes from one page to another. Ideally I want to control this by getting only trades specific to the page the user is on. How can I achieve this? I came across this very good article. http://stackoverflow.com/questions/876976/implementing-ipagedlistt-on-my-models-using-nhibernate But I am not sure if this will work for me, as lazy=extra currently doesnt work as expected with the ReadOnlyCollection. So, if I went ahead and implemented the solution this way and further enhanced it by making the List/Set Immutable, will lazy=extra give me the same problem as with ReadOnlyCollections?

    Read the article

  • How do I query SQLite Database in Android?

    - by kunjaan
    I successfully created the Database and inserted a row however I cannot Query it for some reason. My Droid crashes everytime. String DATABASE_NAME = "myDatabase.db"; String DATABASE_TABLE = "mainTable"; String DATABASE_CREATE = "create table if not exists " + DATABASE_TABLE + " ( value VARCHAR not null);"; SQLiteDatabase myDatabase = null; myDatabase = openOrCreateDatabase(DATABASE_NAME, Context.MODE_PRIVATE, null); myDatabase.execSQL(DATABASE_CREATE); // Create a new row of values to insert. ContentValues newValues = new ContentValues(); // Assign values for each row. newValues.put("value", "kunjan"); // Insert the row into your table myDatabase.insert(DATABASE_TABLE, null, newValues); String[] result_columns = new String[] { "value" }; Cursor allRows = myDatabase.query(true, DATABASE_TABLE, result_columns, null, null, null, null, null, null); if (allRows.moveToFirst()) { String value = allRows.getString(1); TextView foo = (TextView) findViewById(R.id.TextView01); foo.setText(value); } allRows.close(); myDatabase.close();

    Read the article

1