• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Need help

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I'm creatin a simple EJB system.
I have the following database schema :
Table User :
id PK
name not null
email not null
Here is ejbCreate( ) method :

When running the application in JBoss & MySQl server, I got the following exception :
name field can't be null.
Then I modified my table to allow null values, and every thing is Ok !
any help please ...
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What values were passed in to ejbCreate?
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
home.create(new Integer(1), name, email);
nothing special !!
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, what I'm getting at is whether name had a null value. Does your code check for this before invoking home.create?
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, All fields have valid values !
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, first check that the value is not null (in two spots):

1. In ejbCreate, simply do a System.out.println( n );
2. In your client, after create check: System.out.println( myBean.getName() );

If both show it's not null, then I'd check the log for the database (if using JBoss' default, it'd be in hypersonic, so check:
$JBoss_Home/server/data/hypersonic/somelogfile.log"

And see what SQL commands it's executing. It's possible that instead of using:

INSERT INTO MyBean VALUES (1, "My Name", "[email protected]")

it could be using:
INSERT INTO MyBean VALUES (1, null, null)
UPDATE MyBean SET Name = "My Name", Email = "[email protected]" WHERE ID = 1

That would be dumb, but you never know.
reply
    Bookmark Topic Watch Topic
  • New Topic