Hi,

So far Rave has only used the in memory H2 database. I want to configure
Rave to use a MySQL database. The sequence generation annotation we use is
not compatible with MySQL.

As an example the o.a.r.portal.model.Page:
@SequenceGenerator(name="pageIdSeq", sequenceName = "page_id_seq")
/* ... */
public class Page implements BasicEntity, Serializable {
/* ... */
@Id @Column(name="id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "pageIdSeq"
private Long id;

This is the kind of error you get:

Error instantiating named sequence "page_id_seq": Your database
dictionary does not support native sequences.  To tell the dictionary
how to select sequence values, use:
openjpa.jdbc.DBDictionary: NextSequenceQuery="SELECT NEXT VALUE FOR
"page_id_seq"

One way to solve this is to create a orm.xml file that overrides the
GeneratedValue strategy:
  <entity class="org.apache.rave.portal.model.Page">
    <attributes>
      <id name="id">
        <generated-value strategy="SEQUENCE" generator=""/>
      </id>
    </attributes>
</entity>

But this means that if you want to deploy Rave against a MySQL database you
have to check all the beans if they use the @SequenceGenerator and update
your orm.xml.

Another way is to remove the @SequenceGenerator and the reference in
@GeneratedValue (generator="...")

Is there a reason why we explicitly specify the @SequenceGenerator? If not,
can we remove this from all the beans that use it?

Jasha Joachimsthal

Europe - Amsterdam - Oosteinde 11, 1017 WT Amsterdam - +31(0)20 522 4466
US - Boston - 1 Broadway, Cambridge, MA 02142 - +1 877 414 4776 (toll free)

www.onehippo.com

Reply via email to