[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [eclipselink-users] Sequence generator - as a service
|
- From: "Tim Hollosy" <hollosyt@xxxxxxxxx>
- Date: Wed, 6 Aug 2008 17:59:52 -0400
- Delivered-to: eclipselink-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=+9hj+nAbiecZITY/Mcde8XUnqrxGsaKLY8M928RA2lc=; b=RiW1QzMzEbFdym+sO33YXAfa7kQLeOcBkuaMqTYrubmzqRp2U090WfK4H90yTEpHoy RNTesDffH79mHrwCYozbSH/I3FDSfMPy9DsS2PNmPkrVUO2m7Z6yOhMoWsvlIyUuMfjI bsC/DjXEUMIf3B+GH0zOZGAldcxmFJxHHNyug=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=pVCEqOrvkJQ4H9GjM7D3bBhj/3UzooKuw2uubuq76T4DmNPdp0DDv/DGbc7Qko+pCG HxW14AJh9dghUiAu8AcVtjTyLgOpolh8yGMmZIuKQDwl51tUl1m4xQXUzZBWlksfPBdE 3rvQ1xu7+YwZUayS2TQlVvX3fIeKXESqReIf4=
Yes you can :)
Here's a quick snippet that executes a query (sql is your sql string)
and returns a list of SomeRandomPojo (that is not an entity).
Query q = getEntityManager().createNativeQuery(sql);
q.setParameter(1, whatever);
List<Vector> results = (List<Vector>)q.getResultList();
if(results !=null && !results.isEmpty())
{
finalResults = new ArrayList<SomeRandomPojo>();
for (Vector res : results) {
finalResults.add(new
SomeRandomPojo((String)res.get(0),(String)res.get(1),(String)res.get(2)));
}
return finalResults;
}
./tch
On Wed, Aug 6, 2008 at 5:55 PM, Jan Vissers <Jan.Vissers@xxxxxxxxxx> wrote:
> So basically I was wondering whether I can use EclipseLink outside of the
> context of an Entity.
>
>> Might be a silly/hard to understand question...
>>
>> How would I use EclipseLink as a means to implement sequence block
>> pattern? What I want to do is this:
>>
>>
>> a. Remote client (Flex) calls Java service do so work, amongst others it
>> passes in an identifier (initially '0').
>>
>> b. Java service uses 'sequence block' to obtain next unique identifier
>> (not '0') when the passed in identifier is '0'. --> this would be
>> the place where I would want to use EclipseLink <--
>>
>> c. Java service performs requested work and returns the identifier, which
>> might have been not '0' in the first place i.e. passed in at a.
>> or initialized at b.
>>
>> d. Remote client (Flex) continues to call a. as long as there is work to
>> be done. If everything is completed continues with e.
>>
>> e. Remote client (Flex) calls into (another) Java service to 'finalize'
>> the
>> operation. It passes in the not '0' identifier and other stuff.
>>
>> f. Java service uses not '0' identifier as the primary key (@Id) via
>> setId() of a record to be created.
>>
>> Now, let us first wait and see who understands what I'm trying to do here
>> ;-)
>>
>> Thanks,
>> Jan.
>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>
>
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>