02/05/2007: Database Sequences Needed for JBoss Portal & Oracle
When I just installed JBoss it was configured to use Oracle. However, JBoss Portal did not work immediately. I needed to perform the following steps:
1. Copy the Oracle JDBC jar file to [JBOSS.HOME]/server/default/lib.
2. Create database sequences:
create sequence hibernate_sequence;
create sequence portal_seq;
create sequence sec_seq;
create sequence instance_seq;
create sequence portlet_seq;
create sequence user_seq;
I'm not sure when Hibernate didn't create these sequences automatically. I may be an issue specific to Oracle since I don't recall the same problem when using other databases.
UPDATE: JBoss Portal did not automatically create the sequences because I did not copy the Oracle JDBC jar file into the JBOSS.HOME/lib directory immediately after the installation process completed.
12/22/2006: Using a Stored Procedure to Insert Records with Spring & Hibernate
It took a little research to discover how to integrate a stored procedure for inserting records into my application. However, once I found the right piece of information, it became easy.
Here is what I am using:
<hibernate-mapping> <class name="com.codebits.vo.SuperSimpleRecord" table="super_simple"> <id name="id" type="string" length="32" unsaved-value="null"> <generator class="uuid.hex" /> </id> <property name="name" type="string" length="100" not-null="true" /> <property name="count" type="integer" not-null="false" /> <property name="created" type="date" not-null="true" insert="false" /> <sql-insert callable="true" check="none"> {call insert_record(?, ?, ?)} </sql-insert> </class> </hibernate-mapping>
Notice the check attribute? That's what took me awhile to find, I think it was introduced in Hibernate 3.2. Just for completeness, here is my stored procedure:
create or replace procedure insert_record( in_name in varchar2, in_count in number, in_id in varchar2 ) as begin insert into super_simple values(in_id, in_name, in_count, sysdate); commit; end insert_record;