Discussion:
[Middlegen-user] Fw: POST: EJB Question on http://boss.bekk.no/boss/middlegen/samples/airline.ejb.index.html
e***@bekk.no
2004-11-29 11:52:02 UTC
Permalink
Please post this kind of question to the middlegen-user list at sourceforge
:)

Regards
- Eivind Waaler


"Peter Korim"
<***@korim.sk>
To
24.11.2004 11:50 <***@bekk.no>
cc

bcc

Subject













Dear madammes and sirs

I have tryied your sample from the
http://boss.bekk.no/boss/middlegen/samples/airline.ejb.index.html
site

my configuration is jboss 3.2.2
mysql 4.1


1. I have created Light number 21 and Person number 1

2   I tryied to create a reservation and got an error on jboss console
(see bellow):

Is this method working on your site ok?

Thank you in advance for your answer.

Peter Korim
Physter Technology, a.s., Praha




/** ----------------------------------------------------------- J B O S
S   C O N S O L
E  -----------------------------------------------------------------------*/

11:43:23,888 INFO  [NetRequestMessagesBean]  you entered to : reserve
11:43:23,919 INFO  [NetRequestMessagesBean] flight  21 O.K.
11:43:23,951 INFO  [NetRequestMessagesBean] person  1 O.K.
11:43:23,951 INFO  [NetRequestMessagesBean] reservation  1 BEFORE create
11:43:23,997 ERROR [Reservation] Could not create entity
java.sql.SQLException: General error,  message from server: "Column
'person_id_fk' cannot be null"
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1822)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1017)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1106)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2027)
        at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1747)
        at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1593)
        at
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:321)
        at
org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.executeInsert(JDBCAbstractCreateCommand.java:334)
        at
org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:295)




/** -----------------------------------------------------------C O D E
-----------------------------------------------------------------------*/

         if (branch.equals("reserve")) {
        logger.info(" you entered to : " + branch);
        FlightLocal fl = null;
        try
        { fl = FlightUtil.getLocalHome().findByPrimaryKey(new
Integer(21));
          }
        catch (FinderException e) {
          logger.error("flight  21 not found"); }
          catch (NamingException e) { logger.error("what is
flightLocalHome ?");
          return;}
        logger.info("flight  21 O.K.");
        PersonLocal pl = null;
        try
        {pl = PersonUtil.getLocalHome().findByPrimaryKey(new
Integer(1));}
        catch (FinderException e)
        { logger.error("person  1 not found");
        return;}
        catch (NamingException e) { logger.error("what is personLocalHome
?");
        return;}
        logger.info("person  1 O.K.");
        Timestamp now=new
Timestamp(Calendar.getInstance().getTimeInMillis());

        logger.info("reservation  1 BEFORE create");
        try
        {
          ReservationLocal rl =
ReservationUtil.getLocalHome().create(now,fl,pl);
        }
        catch (CreateException e)
        { logger.error("neviem vytvorit reservation");
          e.printStackTrace();
          return;}
        catch (NamingException e)
         { logger.error("kto je reservationLocalHome ?");
         return;}
        logger.info("reservation  1 O.K.");
James Neville
2004-12-14 13:55:04 UTC
Permalink
Hi All,

This question's just a simple case of syntax, I hope.

In my hibernate-prefs.properties I map a bytea column to a binary type
for my hibernate mapping generation:-

------------------------------------------------------------------------------------
hibernate.tables.upload.columns.data.java-name=data
hibernate.tables.upload.columns.data.java-type=binary
hibernate.tables.upload.columns.data.length=10024
------------------------------------------------------------------------------------

I had hoped that setting something like the above '...data.length' would
suffice.
Unfortunately, on generation of the hibernate mapping xml files,
Middlegen will always produce the following:-

------------------------------------------------------------------------------------
<property name="data" type="binary" column="data" length="-1">
<meta attribute="field-description">
@hibernate.property
column="data"
length="-1"
</meta>
</property>
------------------------------------------------------------------------------------

I can replace this with an ant regex task, but some of the binary field
lengths will differ in size.
So, how do I set the length of the generated binary length attribute
*without* manually editing the hibernate mappings afterwards?

Many thanks in advance,

James.



This e-mail is confidential. If you have received it in error, you are on notice of its status. Please notify us immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any other person; to do so could be a breach of confidence. Thank you for your cooperation. Please contact +44 (0) 20 72037300 or email ***@babcockbrown.com if you need assistance.
Loading...