Интересно, насколько широко распространенный JVM на самом деле? В случае Flash IE5 предварительно установил его, дав ему большую автоматическую базу пользователей. Но если JVM не была включена с установкой ОС, у пользователей не будет его. Я предполагаю как разработчик, Вы нацелены на самую большую основу установки, имея в виду выбор Flash over Java.
тут и там существуют апплеты Java; определенно не широко распространенный все же.
The
element is a child of the
element and its content is executed before the main INSERT
statement. You can use two approaches.
Fetch the key after you have inserted the record
This approach works depending on your driver. Threading can be a problem with this.
Fetching the key before inserting the record
This approach avoids threading problems but is more work. Example:
<insert id="insert">
<selectKey keyProperty="myId"
resultClass="int">
SELECT nextVal('my_id_seq')
</selectKey>
INSERT INTO my
(myId, foo, bar)
VALUES
(#myId#, #foo#, #bar#)
</insert>
On the Java side you can then do
Integer insertedId = (Integer) sqlMap.insert("insert", params)
This should give you the key selected from the my_id_seq
sequence.
Вот простой пример:
<statement id="addObject"
parameterClass="test.Object"
resultClass="int">
INSERT INTO objects(expression, meta, title,
usersid)
VALUES (#expression#, #meta#, #title#, #usersId#)
RETURNING id
</statement>
И в коде Java:
Integer id = (Integer) executor.queryForObject("addObject", object);
object.setId(id);
Этот способ лучше, чем использовать: