[jboss-user] [EJB 3.0] - help getting started with eclipse

wiggy do-not-reply at jboss.com
Thu Sep 6 18:53:14 EDT 2007


having basic problems getting to first check point with ejb3 - just starting out and got stuck.

running europa eclipse and run JBOSS AS4.2 and have deployed a mysql JTA datasource in the server and started in Eclipse.

Then I have created an EJB project and decalred an peristence unit xml as follows 


  | <?xml version="1.0" encoding="UTF-8"?>
  | <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  | 	<persistence-unit name="embedDS" transaction-type="JTA">
  |         <provider>org.hibernate.ejb.HibernatePersistence</provider>
  | 		<jta-data-source>jdbc/embedDS</jta-data-source>
  |  		<class>org.model.Message</class>
  |         <properties>
  |             <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
  |             <property name="hibernate.show_sql" value="true"/>
  |         </properties>
  | 	</persistence-unit>
  | </persistence>
  | 

I think i have this right - the defaultDS is still using jboss AS defaults.

I then create simple message persistence entity class  as follows.


  | package org.model;
  | 
  | import javax.persistence.Column;
  | import javax.persistence.Entity;
  | import javax.persistence.GeneratedValue;
  | import javax.persistence.GenerationType;
  | import javax.persistence.Id;
  | import javax.persistence.*;
  | 
  | @Entity
  | @Table(name="message", catalog="embed")
  | public class Message 
  | {
  | 	private long messageID;
  | 	private String message;
  | 
  | 	@Id
  | 	@GeneratedValue(strategy=GenerationType.AUTO)
  | 	@Column(name="messageID")
  | 	public long getMessageID() {
  | 		return messageID;
  | 	}
  | 
  | 	public void setMessageID(long messageID) {
  | 		this.messageID = messageID;
  | 	}
  | 
  | 	public String getMessage() {
  | 		return message;
  | 	}
  | 
  | 	public void setMessage(String message) {
  | 		this.message = message;
  | 	}
  | 	
  | 	
  | 	
  | }
  | 

however in my eclipse editor this wont compile  - the error says 

anonymous wrote : 
  | Severity and Description	Path	Resource	Location	Creation Time	Id
  | Schema "root" cannot be resolved for table "message"	SessionTest/ejbModule/org/model	Message.java	line 11	1189118136216	1813
  | 
  | Severity and Description	Path	Resource	Location	Creation Time	Id
  | Column "messageID" cannot be resolved	SessionTest/ejbModule/org/model	Message.java	line 19	1189118136216	1811
  | 
  | and 
  | 
  | Severity and Description	Path	Resource	Location	Creation Time	Id
  | Column "message" cannot be resolved	SessionTest/ejbModule/org/model	Message.java	line 28	1189118136216	1812
  | 
  | 

- cant therefore compile nor test the rest of my understanding if i cant get past this.  

the error Schema "root" cannot be resolved for table "message" is associated with the @table annotation - 

any ideas as what I am doing wrong here ?



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

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



More information about the jboss-user mailing list