[jboss-user] [EJB 3.0] - get Object field in MS SQL

ccharpentier do-not-reply at jboss.com
Mon Aug 21 05:37:28 EDT 2006


I've got jboss 4.0.4GA with MS SQLSERVER

I want to create an Image type field in MS SQL within an ejb3.

when i look in the mapping file standardjaws.xml

  | <mapping>
  | 	    <java-type>java.lang.Object</java-type>
  | 	    <jdbc-type>JAVA_OBJECT</jdbc-type>
  | 	    <sql-type>IMAGE</sql-type>
  | 	 </mapping>
  | 

here this is my entity


  | import java.sql.Date;
  | 
  | import javax.persistence.Entity;
  | import javax.persistence.GeneratedValue;
  | import javax.persistence.Id;
  | import javax.persistence.Table;
  | 
  | import org.hibernate.annotations.Type;
  | 
  | @Entity
  | @Table(name="FichierOma")
  | public class FichierOma {
  | 
  | 	Integer 	id;
  | 	String		numCommande;
  | 	String		numJob;
  | 	String		idClient;
  | 	Date		insertDate;
  | 	Object		fichierOma;
  | 	/**
  | 	 * @return Returns the fichierOma.
  | 	 */
  | 
  | 	public Object getFichierOma() {
  | 		return fichierOma;
  | 	}
  | 	/**
  | 	 * @param fichierOma The fichierOma to set.
  | 	 */
  | 	public void setFichierOma(Object fichierOma) {
  | 		this.fichierOma = fichierOma;
  | 	}
  | 	
  | 	/**
  | 	 * @return Returns the id.
  | 	 */
  | 	@Id
  | 	@GeneratedValue
  | 	public Integer getId() {
  | 		return id;
  | 	}
  | 	/**
  | 	 * @param id The id to set.
  | 	 */
  | 	public void setId(Integer id) {
  | 		this.id = id;
  | 	}
  | 	/**
  | 	 * @return Returns the idClient.
  | 	 */
  | 	public String getIdClient() {
  | 		return idClient;
  | 	}
  | 	/**
  | 	 * @param idClient The idClient to set.
  | 	 */
  | 	public void setIdClient(String idClient) {
  | 		this.idClient = idClient;
  | 	}
  | 	/**
  | 	 * @return Returns the insertDate.
  | 	 */
  | 	public Date getInsertDate() {
  | 		return insertDate;
  | 	}
  | 	/**
  | 	 * @param insertDate The insertDate to set.
  | 	 */
  | 	public void setInsertDate(Date insertDate) {
  | 		this.insertDate = insertDate;
  | 	}
  | 	/**
  | 	 * @return Returns the numCommande.
  | 	 */
  | 	public String getNumCommande() {
  | 		return numCommande;
  | 	}
  | 	/**
  | 	 * @param numCommande The numCommande to set.
  | 	 */
  | 	public void setNumCommande(String numCommande) {
  | 		this.numCommande = numCommande;
  | 	}
  | 	/**
  | 	 * @return Returns the numJob.
  | 	 */
  | 	public String getNumJob() {
  | 		return numJob;
  | 	}
  | 	/**
  | 	 * @param numJob The numJob to set.
  | 	 */
  | 	public void setNumJob(String numJob) {
  | 		this.numJob = numJob;
  | 	}
  | 	
  | }
  | 

when I deploy this ejb3
i get this error


  | ObjectName: persistence.units:jar=formOma.par.jar,unitName=formoma
  |   State: FAILED
  |   Reason: org.hibernate.MappingException: property mapping has wrong number of c
  | olumns: com.edieyes.oma.entities.FichierOma.fichierOma type: object
  | 


If i replace Object by String in my entity everything is OK.

if somebody have a clue?

thanks

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966403#3966403

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966403



More information about the jboss-user mailing list