-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: 2 problems switching to mysql
PostPosted: Thu Mar 29, 2007 3:17 am 
Newbie

Joined: Tue Feb 27, 2007 3:58 am
Posts: 5
Location: Netherlands
Hibernate version: 3.1.1
Exception:
- Unknown table 'SEQ_..._PK' in field list
- Every derived table must have its own alias
Database: MysqL

Hello, I'm working on a webapplication and until now it has always worked with Oracle.
But I'm currently busy to make the webapp also use MySQL.

The first problem I have is that we've declared this in the xdoclet;
Code:
* @bo.id
*      column="xxx_id"
*      type="INTEGER"
*      length="32"
*      required="true"
*      generator-class="native"
*      generator-sequence="SEQ_xxx_PK"


MySQL doesn't support sequences, so is there a way to solve this, that it'll work for MySQL and for Oracle?


The second problem I'm having is that I get the error "Every derived table must have its own alias".
And I'm just using Criteria to get the data, so Hibernate generates the query for me... how can I solve this?

For example;
Code:
Criteria criteria = session.createCriteria(TimeRecord.class);
criteria.add(Expression.eq("flowState", FlowState.CLOSED));
criteria = criteria.createCriteria("assignment");
Criterion closed = Expression.eq("flowState", FlowState.CLOSED);
Criterion exported = Expression.eq("flowState", FlowState.EXPORTED);
criteria.add(Expression.or(closed, exported));
Collection records = criteria.list();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.