-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Annotations beta 2 and native SQL queries
PostPosted: Fri May 27, 2005 4:50 pm 
Beginner
Beginner

Joined: Wed Mar 03, 2004 9:44 am
Posts: 23
Location: Brasil
Hello, please, see the code below:

@Entity(name="PrecoDiaAjustado", entityType=EntityType.BMP, access=AccessType.PROPERTY, version=3)
@SqlResultSetMapping(name="MAP_PrecoDiaAjustado_SP", entities={@EntityResult(name="br.com.valoriza.addin.acoes.persistencia.PrecoDiaAjustado")})
@NamedQuery(name="PrecoDiaAjustado_SP", queryString="{ ? = call a_ADDIN_GetDadoAjustado (?, ?, ?, ?) }", resultType="MAP_PrecoDiaAjustado_SP")
public class PrecoDiaAjustado implements Serializable {
private double valor;

@Column(name="Valor", primaryKey=true)
public double getValor() {
return valor;
}

public void setValor(double valor) {
this.valor = valor;
}

}

When I try to map this class with the AnnotationConfiguration class, I get:

Caused by: java.lang.NullPointerException
at org.hibernate.mapping.PersistentClass.createPrimaryKey(PersistentClass.java:283)

Why? My stored procedure returns only one resultset with the "valor" field, there isn't a primary key. I'm using Hibernate 3.0.5 and Annotations beta2.

[]s

Ary Junior


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 11:36 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Your class has to have an @Id annotation.

But unfortunatly, Hibernate Annotations does not support callable statements yet (thus not stored procedures). Sorry about that.

_________________
Emmanuel


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

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.