Finding a first object

View: New views
7 Messages — Rating Filter:   Alert me  

Finding a first object

by Ulu-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi List,

Sometimes I need to get just *any* object of a certain kind. For example, when I create a Movie, I have to assign a Category to it, and later a user could change it to a different Category.

So, a natural way would be to do it like that:
return new CategoryFactory(myContext).FindFirst(null);

Since it throws an exception, I have to fake a search by doing something like,
return new CategoryFactory(myContext).FindFirst("ID!=0");

So, is there a truly simple and natural way of getting a first available object?

ulu

P.S. FindWithLimit also throws an exeption (of course). However, Find((Qualifier)null) behaves nicely and returns all records.



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Fields TEXT and NTEXT

by Omar del Valle Rodríguez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello list,

SQL Server does not allow the use of '=' to compare TEXT fields and so
WriteOptimisticLockMatch() will fail.

So what is the best way to workaround this problem in v 1.4?

Thanks
Omar

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/ 


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Parent Message unknown Re: Fields TEXT and NTEXT

by Jim Arnold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is (I think) still an outstanding issue, but there are workarounds.
There is a JIRA ticket describing the problem and a workaround here:

http://jira.codehaus.org/browse/NEO-5?page=comments#action_60596

Jim

-----Omar del valle Rodríguez <omarvr72@...> wrote: -----


To: <user@...>
From: Omar del valle Rodríguez <omarvr72@...>
Date: 11/08/2006 03:19PM
Subject: [neo-user] Fields TEXT and NTEXT

Hello list,

SQL Server does not allow the use of '=' to compare TEXT fields and so
WriteOptimisticLockMatch() will fail.

So what is the best way to workaround this problem in v 1.4?

Thanks
Omar

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/


---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


delete N rows

by Omar del Valle Rodríguez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hellos users,

In Neo we can delete multiple rows in one instrucción?

For example: myEntity.Delete("field_1={0} and field_2={1}, value_1,
value_2);

Thanks.. sorry my poor english please..

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/ 


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: delete N rows

by Ulu-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi List,

Tuesday, November 14, 2006, 11:54:28 PM, I'm reading this:

OdvR> Hellos users,

OdvR> In Neo we can delete multiple rows in one instrucción?

OdvR> For example: myEntity.Delete("field_1={0} and field_2={1}, value_1,
OdvR> value_2);

OdvR> Thanks.. sorry my poor english please..

No, we can't, but I wish we could..

I've been thinking about that possibility recently. I guess this could be implemented like that:

1. Prepare an SQL DELETE statement and save it in some sort of a queue (note that we don't execute it until Context.SaveChanges is called).
2. Delete all corresponding objects already loaded.
3. When Context.SaveChanges is called, after ProcessDeletes call the saved query

Note that building the query should be simple, since we already know how to parse the qualifier and build the WHERE clause. Deleting the in-memory objects should be no harder than selecting them and deleting one-by-one.

Where could be any unexpected things, though. However, this could be much better than retrieving all necessary objects and deleting them manually.

ulu


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


One to One relation

by Omar del Valle Rodríguez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello users,

Please, sorry my english..

I'm try make one to one relation with Neo. (1.4.2)

I have 3 tables,

1- Client
2- Company
3- User

Client have fields common between Company and User. Client, Company and User
have one to one relation.

<database..... defaultIdMethod="native">
.....
<table name="crw_clients" javaName="Client">
<column name="client_id" javaName="client_id" type="INTEGER"
primaryKey="true" />
.....
<iforeign-key foreignTable="crw_company" name="CompanyRef">
   <ireference local="client_id" foreign="client_id"/>
</iforeign-key>
<iforeign-key foreignTable="crw_users" name="UserRef">
   <ireference local="client_id" foreign="client_id"/>
</iforeign-key>
</table>

<table name="crw_company" javaName="Company" idMethod="none">
<column name="client_id" javaName="client_id" type="INTEGER" hidden="true"
primaryKey="true" />
.....
</table>

<table name="crw_users" javaName="User" idMethod="none">
<column name="client_id" javaName="client_id" type="INTEGER" hidden="true"
primaryKey="true" />

.....
</table>

1- Creating Company:

Client client = new ClientFactory(DefaultContext.Instance).CreateObject();
...
Company company = new
CompanyFactory(DefaultContext.Instance).CreateObject(client);
...

DefaultContext.Instance.SaveChanges();
// throw exception saving Company (Integral reference Client and Company)


2- In Client entity

public bool is_company
{
    get { return (client.CompanyRef =! null); }
    //throw exception in Neo if not exist in reference in Company(Object not
found)
}

Any Help.. Thanks...
Omar



__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/ 


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: One to One relation

by Ulu-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi  List,

This looks like a bug that I've already encountered (and forgot to put to the bug database)

The code generator infers relationship direction  incorrectly in this case (it goes child in both directions).

Will have to correct the code for Neo.EntityModel

Ulu

Monday, December 11, 2006, 7:02:04 PM:

OdvR> Hello users,

OdvR> Please, sorry my english..

OdvR> I'm try make one to one relation with Neo. (1.4.2)

OdvR> I have 3 tables,

OdvR> 1- Client
OdvR> 2- Company
OdvR> 3- User

OdvR> Client have fields common between Company and User. Client, Company and User
OdvR> have one to one relation.

OdvR> <database..... defaultIdMethod="native">
OdvR> .....
OdvR> <table name="crw_clients" javaName="Client">
OdvR> <column name="client_id" javaName="client_id" type="INTEGER"
primaryKey="true" />>
OdvR> .....
OdvR> <iforeign-key foreignTable="crw_company" name="CompanyRef">
OdvR>    <ireference local="client_id" foreign="client_id"/>
OdvR> </iforeign-key>
OdvR> <iforeign-key foreignTable="crw_users" name="UserRef">
OdvR>    <ireference local="client_id" foreign="client_id"/>
OdvR> </iforeign-key>
OdvR> </table>

OdvR> <table name="crw_company" javaName="Company" idMethod="none">
OdvR> <column name="client_id" javaName="client_id" type="INTEGER" hidden="true"
primaryKey="true" />>
OdvR> .....
OdvR> </table>

OdvR> <table name="crw_users" javaName="User" idMethod="none">
OdvR> <column name="client_id" javaName="client_id" type="INTEGER" hidden="true"
primaryKey="true" />>

OdvR> .....
OdvR> </table>

OdvR> 1- Creating Company:

OdvR> Client client = new ClientFactory(DefaultContext.Instance).CreateObject();
OdvR> ...
OdvR> Company company = new
OdvR> CompanyFactory(DefaultContext.Instance).CreateObject(client);
OdvR> ...

OdvR> DefaultContext.Instance.SaveChanges();
OdvR> // throw exception saving Company (Integral reference Client and Company)


OdvR> 2- In Client entity

OdvR> public bool is_company
OdvR> {
OdvR>     get { return (client.CompanyRef =! null); }
OdvR>     //throw exception in Neo if not exist in reference in Company(Object not
OdvR> found)
OdvR> }

OdvR> Any Help.. Thanks...
OdvR> Omar



OdvR> __________________________________________________
OdvR> Correo Yahoo!
OdvR> Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
OdvR> Regístrate ya - http://correo.yahoo.com.mx/ 


OdvR> ---------------------------------------------------------------------
OdvR> To unsubscribe from this list please visit:

OdvR>     http://xircles.codehaus.org/manage_email





Àðòåì


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email