Jamie | 1 Apr 01:49 2005

Re: DataObject becomes hollow when passed through a tapestry DirectLink

Sure, that's how I would generally get an object... just pass the id 
around and get it again. In my particular example, that didn't work. The 
object itself doesn't exist in the database per se and we needed an easy 
way to transport the data around. The datasqueezer really shines here. 
What's it's written and registered Tapestry just knows what to do--just 
pass it as a parameter and it gets squeezed automatically. Love it!

Jamie

Andrus Adamchik wrote:

>Hi Jamie,
>
>  
>
>>One thing Richard added was to put the squeeze() code into the object
>>itself so only one object had to be modified as we developed. He made a
>>constructor that takes the sqeezed object and converts it back into the
>>unsqueezed object.
>>    
>>
>
>Cayenne works on the assumption that each object is uniqie within
>DataContext (a very nice feature that ensures object graph consistency).
>As a result the solution with constructor will not work for persistent
>objects, as deserialization must be able to return an object that is
>already in memory (not necessarily create a new one every time). So I am
>looking in the direction of "readResolve()" method supported by Java
>serialization mechanism
>(http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html). It
(Continue reading)

Eric Schneider | 1 Apr 03:52 2005

Re: DataObject becomes hollow when passed through a tapestry DirectLink

Damn.  I just can't keep up with the lingo.   Well, hopefully you'll 
think Cayenne is phat (with "ph")....I'm mean really bad (in a good 
way).

Cheers,
e.

On Mar 31, 2005, at 5:11 PM, Andrus Adamchik wrote:

> Heh, I immediately thought of "Ant in Anger" paper, still I was 
> confused
> for a moment too. So it is just "welcome" then, without the "??" part 
> :-)
>
> Andrus
>
>> On Mar 31, 2005, at 11:43 AM, Eric Schneider wrote:
>>
>>> Erik,
>>>
>>>> I'm going to start using Cayenne "in anger" shortly
>>>
>>> Welcome to the community...i guess??   Hopefully we can make your
>>> experience less awful.
>>
>> Haha!  I think I was misinterpreted using an expression I never use.  
>> I
>> first came across the expression "in anger" here:
>>
>> 	http://ant.apache.org/ant_in_anger.html
(Continue reading)

Craig Turner | 1 Apr 03:58 2005

Querying for objects where the primary key does not equal a supplied value

Thanks for the help with the issue yesterday guys.

I've found some resoures on getting an object out by its primary key, 
but is there a way to query by items that don't match a given primary key?

Late yesterday I was trying to construct a query that excluded matches 
of the primary key for a table. The situation is that I have a series of 
locations, and their names must be unique. As part of validation I 
wanted to run a query to do this:

select *
   from Location l
  where 1=1
    and lower(l.name) = '{location name to validate}'
    and id <> '{object I'm currently using}'

The solution I ended up using to get around this was to get all results 
with a matching name, and then to the item I'm using from the list, and 
then see if there's anything left in the list. There's an alternative 
solution where you find out whether this is a new object or an existing 
object, and treat them differently. This gets complicated because you 
need to buffer the location name of the existing object in case of a 
name change. Both solutions seem less than ideal.

(While trying to get this working, at one point I tried adding the id to 
the entity in the cayenne interface. However when I did this I think the 
object stopped creating the primary key automatically for new objects)

   - C

(Continue reading)

Craig Turner | 1 Apr 04:01 2005

Re: Querying for objects where the primary key does not equal a supplied value

> The solution I ended up using to get around this was to get all results 
> with a matching name, and then to the {} item I'm using from the list, and 

That should have been "and then to remove the item I'm using from the list".

   - C

Andrus Adamchik | 1 Apr 04:44 2005

Re: [news] Re: Status of MySQL AUTO_INCREMENT Support?

IMO auto-increment (aka generated keys) addition to JDBC standard is 
there to cause confusion :-) ... Driver support for it ranges from poor 
to non-existent. So on the database end you can have a number of 
mechanisms to get a PK generated on row insert (triggers being one of 
them), but propagating it to Java layer is another story... AFAIK only 
SQLServer and MySQL proprietary mechanisms have JDBC mapping (if you 
know of others, please post it here) ...

So my advise - use current mechanism based on sequences, esp. since you 
already have them in the DB. And yes, you can assign custom names in 
the Modeler.

Andrus

On Mar 31, 2005, at 12:29 PM, David Norwood wrote:

> Hi,
>
> I am using an Oracle DB that has auto-incremented (trigger-generated
> integer) primary keys for every table. In addition, each table has its 
> own
> sequence. The trigger will check for a non-zero or null and use that 
> value
> if it's passed in. In the past, I've had to modify the 2 Cayenne 
> classes
> (below) to bypass the problem; now it seems that the PK generation is
> customizable per table.
>
> Question is, which is now best practice:
>
(Continue reading)

Cris Daniluk | 1 Apr 04:50 2005

RE: [news] Re: Status of MySQL AUTO_INCREMENT Support?

Postgres has a mapping through the SERIAL datatype. However, I've found its
use to be convoluting  during prototyping, etc (it automatically creates a
named sequence that isn't automatically dropped when the table is dropped) 

However, it truly is automatic...

Cris
> 
> IMO auto-increment (aka generated keys) addition to JDBC 
> standard is there to cause confusion :-) ... Driver support 
> for it ranges from poor to non-existent. So on the database 
> end you can have a number of mechanisms to get a PK generated 
> on row insert (triggers being one of them), but propagating 
> it to Java layer is another story... AFAIK only SQLServer and 
> MySQL proprietary mechanisms have JDBC mapping (if you know 
> of others, please post it here) ...
> 

Andrus Adamchik | 1 Apr 05:01 2005

Re: [news] Re: Status of MySQL AUTO_INCREMENT Support?

The question is whether it is being returned via 
java.sql.Statement.getGeneratedKeys() ... IIRC my earlier testing 
showed that it doesn't work...

Andrus

On Mar 31, 2005, at 9:50 PM, Cris Daniluk wrote:

> Postgres has a mapping through the SERIAL datatype. However, I've 
> found its
> use to be convoluting  during prototyping, etc (it automatically 
> creates a
> named sequence that isn't automatically dropped when the table is 
> dropped)
>
> However, it truly is automatic...
>
> Cris
>>
>> IMO auto-increment (aka generated keys) addition to JDBC
>> standard is there to cause confusion :-) ... Driver support
>> for it ranges from poor to non-existent. So on the database
>> end you can have a number of mechanisms to get a PK generated
>> on row insert (triggers being one of them), but propagating
>> it to Java layer is another story... AFAIK only SQLServer and
>> MySQL proprietary mechanisms have JDBC mapping (if you know
>> of others, please post it here) ...
>>
>
>
(Continue reading)

Cris Daniluk | 1 Apr 05:04 2005

RE: [news] Re: Status of MySQL AUTO_INCREMENT Support?

8.0 was supposed to add that, but I'm not sure that it did. Really, even if
it did I would not prefer it over getting straight to the sequences. All it
is now, and all it ever will be, is a fa├žade to sequences, which are already
working fine in 1.2...

Just wanted to mention it though :)

> The question is whether it is being returned via
> java.sql.Statement.getGeneratedKeys() ... IIRC my earlier 
> testing showed that it doesn't work...
> 
> Andrus
> 
> 
> On Mar 31, 2005, at 9:50 PM, Cris Daniluk wrote:
> 
> > Postgres has a mapping through the SERIAL datatype. However, I've 
> > found its use to be convoluting  during prototyping, etc (it 
> > automatically creates a named sequence that isn't automatically 
> > dropped when the table is
> > dropped)
> >
> > However, it truly is automatic...
> >
> > Cris
> >>
> >> IMO auto-increment (aka generated keys) addition to JDBC 
> standard is 
> >> there to cause confusion :-) ... Driver support for it ranges from 
> >> poor to non-existent. So on the database end you can have 
(Continue reading)

Robert Zeigler | 2 Apr 06:17 2005
Picon

Re: DataObject becomes hollow when passed through a tapestry DirectLink

Robert Zeigler wrote:
> Erik Hatcher wrote:
> 
>>Regarding using a rich (i.e. not a String or simple type) object as a
>>parameter in a DirectLink - this is not really recommended in the
>>general sense.  The URL is going to be hideous and perhaps even too long
>>for some browsers to handle.
>>
>>A trick within Tapestry, though, would be to use a custom DataSqueezer
>>that serialized only the primary key and a unique prefix, and then
>>"deserialized" by fetching again using the facility Andrus describes
>>below.  I have not tried this route - have others?
>>
>>    Erik
>>
> 
> 
> So, I've been thinking about this approach a bit more...
> The major issue I'm seeing with this approach is that when you unsqueeze
> the object, a lookup based on the id depends on knowing which table to
> look things up from. Thus, it seems that you would either have to do one
> of two things.
> 1) Write a custom adaptor for each persistent object... not fun. =)
> 2) include the class info in the the url....  This is the most generic
> solution; it requires no updating later when you add new objects, start
> a new project, etc.
> 3) something else that I'm missing?

3) grab the object entity name from the cayenne data object, and use
that to refetch the object, instead of the class name. =)
(Continue reading)

Nick Westgate | 5 Apr 12:56 2005
Picon

Re: Q: Anyone using a FileMaker Pro 'database' successfully?

Hi Andrus.

Thanks for your reply. You are lucky not to have had experience
with FileMaker. Or at least its xDBC drivers anyway. ;-)

I have no choices here. FileMaker supplies a DataDirect SequeLink
driver which is of very disappointing quality. The latest version
stops even iSQL-Viewer from working.

So today I installed MySQL, and I'll see if I have time to explore
Cayenne with that, then try the hand-coded approach you suggest.

Thanks again,
Nick.

Andrus Adamchik wrote:
> I have no experience with FileMaker... Can you doublecheck that
> CayenneModeler uses the same JDBC driver as you've used with iSQL-Viewer?
> Also is there a "native" pure Java JDBC driver for FileMaker that is not
> going via ODBC ?  You will likely have better chances with it than with
> JDBC/ODBC bridge.
> 
> And of course if nothing works, you can always enter entities by hand in
> the Modeler or in the XML.
> 
> Andrus
> 
> 
> 
> 
(Continue reading)


Gmane