Hi,Dave,
After more than two days testing,I found this method as below cannot
work with Geotools Feature even I test it is ok with psql.The Geotools
Feature cannot get the serial type field. It ignore the Serial Type
field when I do a query. As Chris said, I have to create my own JDBC
connection if you want to manipulate the Sequence Type filed. That's
more easier for me. If you have any more suggestions, PLS let me know.
Thanks
Rong
Hi, Dave,
Thank you very much for the suggestions. Actually, I used the serial
data type for the unique sequence key. The postgresSql will generate a
sequence for the serial data type. It's my fault I didn't explain the
question clearly. My question is: If I insert the serial key field,
before I commit the transaction, can I get the new key from a sql
"select" statement inside the same transaction? I did a test via psql
with AUTCOMMIT off. I get the result thatI can get the new key in the
same transaction even I cannot see the new key from another transaction.
Actually, chris give me a very good anwser for me to the confusion of
how to get the JDBC connection directly from DataStore. You know as
general java program, I'm more used to the SQL statement and use the
JDBC stuff. I'm not familiar with Filter and query stuff. But after
search the source and I figure out how to use them now.
Thank you guys very much and Have good weekend
Rong.You can do part of this with a serial column:
cite=# create table abc (i int, s serial, t text);
NOTICE: CREATE TABLE will create implicit sequence "abc_s_seq" for
serial column "abc.s"
CREATE TABLE
cite=# insert into abc (i,t) values (111,'dave');
INSERT 32329 1
cite=# insert into abc (i,t) values (222,'chris');
INSERT 32330 1
cite=# select * from abc;
i | s | t
-----+---+-------
111 | 1 | dave
222 | 2 | chris
(2 rows)NOTE: the "s" (serial) column will be automatically updated for you.
To get the other table to "align" with your updated values, you can use
triggers or rules. See the postgresql manual on how to use these (and
also see the documentation on views).
If you want to do more complex processing inside geotools, I'd
recommend that you make your own JDBC datastore. Gabriel is currently
making an "advanced" JDBC datastore, so he might have some insight.
dave
----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel