Hi!
This should be sent to the jboss-user mailing list.
Thanks,
Rickard
----- Original Message -----
From: Sang-Moon Oh <[EMAIL PROTECTED]>
To: jboss-dev <[EMAIL PROTECTED]>
Sent: Friday, October 20, 2000 10:38 AM
Subject: [jBoss-Dev] Dose jBoss 2.0 BP 2 supports MySQL
> I'm in trouble to develop CMP entity bean using MySQL. I examined my
> code and config files over and over through 2 or 3 days. But I cann't
> find any solution.
>
> So I wanna ask to the developers. Does jBoss 2.0 BP 2 support
> MySQL. If so, what version of MySQL and JDBC driver for MySQL is
> needed.
>
>
> My pilot system's environment is like the following.
>
>
> O/S : Red Hat Linux 6.1
> JDK : JDK Standard Ed. 1.3.0 for Liunux by Sun
> jBoss : jBoss 2.0 Beta Products 2
> MySQL : MySQL 3.22.32
> JDBC Driver for MySQL : MM MySQL JDBC driver 1.2c and 2.0.2
>
>
> The code and config files are
> =================================================================
> package kr.pe.thirdstage.rocklibrary;
>
> import javax.ejb.EntityContext;
>
>
> /**
> *
> */
> public class SongBean implements javax.ejb.EntityBean{
>
> public String id;
> public String title;
> public String artist;
> public String album;
> public String year;
> public String notes;
>
> public EntityContext ejbContext;
>
>
> public void setEntityContext(EntityContext cntx){
>
> this.ejbContext = cntx;
> }
>
>
> public void unsetEntityContext(){
>
> this.ejbContext = null;
> }
>
>
> /**
> *
> */
> public SongKey ejbCreate(String id, String title, String artist,
> String album, String year, String notes){
>
> this.id = id;
> this.title = title;
> this.artist = artist;
> this.album = album;
> this.year = year;
> this.notes = notes;
> return null;
> }
>
>
> public void ejbPostCreate(String id, String title, String artist,
> String album, String year, String notes){
>
> }
>
> public void ejbRemove(){}
> public void ejbActivate(){}
> public void ejbPassivate(){}
> public void ejbLoad(){}
> public void ejbStore(){}
>
>
> // business methods.
>
> public String getID(){
> return this.id;
> }
>
> public void setID(String id){
> this.id = id;
> }
>
> public String getTitle(){
> return this.title;
> }
>
> public void setTitle(String title){
> this.title = title;
> }
>
> public String getArtist(){
> return this.artist;
> }
>
> public void setArtist(String artist){
> this.artist = artist;
> }
>
> public String getAlbum(){
> return this.album;
> }
>
> public void setAlbum(String album){
> this.album = album;
> }
>
> public String getYear(){
> return this.year;
> }
>
> public void setYear(String year){
> this.year = year;
> }
>
> public String getNotes(){
> return this.notes;
> }
>
> public void setNotes(String notes){
> this.notes = notes;
> }
> }
>
>
> =====================================================
>
>
> ejb-jar.xml includes
>
> =====================================================
> ...
>
> <entity>
> <description>Represents song entity</description>
> <ejb-name>Song</ejb-name>
> <home>kr.pe.thirdstage.rocklibrary.SongHome</home>
> <remote>kr.pe.thirdstage.rocklibrary.Song</remote>
> <ejb-class>kr.pe.thirdstage.rocklibrary.SongBean</ejb-class>
>
> <persistence-type>Container</persistence-type>
>
> <prim-key-class>kr.pe.thirdstage.rocklibrary.SongKey</prim-key-class>
> <reentrant>False</reentrant>
> <cmp-field><field-name>id</field-name></cmp-field>
> <cmp-field><field-name>title</field-name></cmp-field>
> <cmp-field><field-name>artist</field-name></cmp-field>
> <cmp-field><field-name>album</field-name></cmp-field>
> <cmp-field><field-name>year</field-name></cmp-field>
> <cmp-field><field-name>notes</field-name></cmp-field>
> <resource-ref>
> <description>DataSource for the Rock
> Library</description>
> <res-ref-name>jdbc/ThirdStage</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> </entity>
> ...
> ============================================================
>
>
>
> The jaws.xml includes
>
> ============================================================
> <jaws>
> <datasource>ThirdStage</datasource>
> <type-mapping>MySQL</type-mapping>
> <default-entity>
> <create-table>false</create-table>
> <remove-table>false</remove-table>
> <tuned-updates>true</tuned-updates>
> <read-only>false</read-only>
> <time-out>300</time-out>
> </default-entity>
> <type-mappings>
> <type-mapping>
> <name>MySQL</name>
> <mapping>
> <java-type>java.lang.Float</java-type>
> <jdbc-type>FLOAT</jdbc-type>
> <sql-type>FLOAT</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.Double</java-type>
> <jdbc-type>DOUBLE</jdbc-type>
> <sql-type>DOUBLE</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.Boolean</java-type>
> <jdbc-type>BIT</jdbc-type>
> <sql-type>BIT</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.Object</java-type>
> <jdbc-type>BLOB</jdbc-type>
> <sql-type>BLOB</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.Integer</java-type>
> <jdbc-type>INTEGER</jdbc-type>
> <sql-type>INTEGER</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.Short</java-type>
> <jdbc-type>INTEGER</jdbc-type>
> <sql-type>INTEGER</sql-type>
> </mapping>
> <mapping>
> <java-type>java.sql.TimeStamp</java-type>
> <jdbc-type>TIMESTAMP</jdbc-type>
> <sql-type>TIMESTAMP</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.Byte</java-type>
> <jdbc-type>TINYINT</jdbc-type>
> <sql-type>TINYINT</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.Character</java-type>
> <jdbc-type>CHAR</jdbc-type>
> <sql-type>CHAR</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.Long</java-type>
> <jdbc-type>BIGINT</jdbc-type>
> <sql-type>BIGINT</sql-type>
> </mapping>
> <mapping>
> <java-type>java.lang.String</java-type>
> <jdbc-type>VARCHAR</jdbc-type>
> <sql-type>VARCHAR(255)</sql-type>
> </mapping>
> <mapping>
> <java-type>java.util.Date</java-type>
> <jdbc-type>DATE</jdbc-type>
> <sql-type>DATE</sql-type>
> </mapping>
> </type-mapping>
> </type-mappings>
> <enterprise-beans>
> <entity>
> <ejb-name>Song</ejb-name>
> <table-name>Song</table-name>
> <cmp-field>
> <field-name>id</field-name>
> <column-name>id</column-name>
> <jdbc-type>VARCHAR</jdbc-type>
> <sql-type>VARCHAR(10)</sql-type>
> </cmp-field>
> <cmp-field>
> <field-name>title</field-name>
> <column-name>title</column-name>
> <jdbc-type>VARCHAR</jdbc-type>
> <sql-type>VARCHAR(100)</sql-type>
> </cmp-field>
> <cmp-field>
> <field-name>artist</field-name>
> <column-name>artist</column-name>
> <jdbc-type>VARCHAR</jdbc-type>
> <sql-type>VARCHAR(60)</sql-type>
> </cmp-field>
> <cmp-field>
> <field-name>album</field-name>
> <column-name>album</column-name>
> <jdbc-type>VARCHAR</jdbc-type>
> <sql-type>VARCHAR(100)</sql-type>
> </cmp-field>
> <cmp-field>
> <field-name>year</field-name>
> <column-name>year</column-name>
> <jdbc-type>VARCHAR</jdbc-type>
> <sql-type>VARCHAR(4)</sql-type>
> </cmp-field>
> <cmp-field>
> <field-name>notes</field-name>
> <column-name>notes</column-name>
> <jdbc-type>VARCHAR</jdbc-type>
> <sql-type>VARCHAR(200)</sql-type>
> </cmp-field>
> </entity>
> </enterprise-beans>
> </jaws>
> ===========================================================
>
>
> The jboss.xml inclueds
>
> =============================================================
> <jboss>
>
> <resource-managers>
> <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
>
> <res-name>jdbc/ThirdStage</res-name>
> <res-jndi-name>ThirdStage</res-jndi-name>
> </resource-manager>
> </resource-managers>
>
> </jboss>
> ============================================================
>
>
> finally server setting files are
>
>
> The jboss.properties includes the following.
>
>
> jdbc.drivers=org.hsql.jdbcDriver,jdbc.idbDriver,org.gjt.mm.mysql.Driver
> ...
>
>
> The jboss.conf includes the following.
>
> <MLET CODE="org.jboss.jdbc.XADataSourceLoader"
> ARCHIVE="jboss.jar,mm.mysql-2.0.2-bin.jar" CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="ThirdStage">
> <ARG TYPE="java.lang.String"
> VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> </MLET>
>
>
> The jboss.jcml includes the following.
>
> <mbean
> name="DefaultDomain:service=XADataSource,name=ThirdStage">
> <attribute name="Properties"></attribute>
> <attribute
> name="URL">jdbc:mysql://localhost/thirdstage</attribute>
> <attribute name="GCMinIdleTime">1200000</attribute>
> <attribute name="JDBCUser">amanda</attribute>
> <attribute name="MaxSize">0</attribute>
> <attribute name="Password">hollyan</attribute>
> <attribute name="GCEnabled">false</attribute>
> <attribute name="InvalidateOnError">false</attribute>
> <attribute name="TimestampUsed">false</attribute>
> <attribute name="Blocking">false</attribute>
> <attribute name="GCInterval">120000</attribute>
> <attribute name="IdleTimeout">1800000</attribute>
> <attribute name="IdleTimeoutEnabled">false</attribute>
> <attribute name="LoggingEnabled">false</attribute>
> <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
> <attribute name="MinSize">0</attribute>
> </mbean>
>
> ================================================================
>
>
> I succeded to deploy the above bean. but when I lookup and call
> finder method in the client application, the bean doesn't return the
> expected result. The findAll or findByPrimaryKey method always
> returns the empty result. Of course there's amount of data in the
> database
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ============================================================
> Sang-Moon Oh
> Dacom System Technologies
>
>
> address : 15th Fl. Hansol Bldg.
> 736-1, Yoksam-dong, Kangnam-ku, Seoul, Korea
> 135-080
>
> tel : +082-2-2185-1217
> fax : +082-2-2185-1993
> pager : 012-365-9477
> e-mail : [EMAIL PROTECTED]
> homepage : http://user.chollian.net/~halfface/
> ============================================================
>
>
>