• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble understanding abstract-schema-name  RSS feed

 
Chris Voge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm fairly new to using EJB's. I just successfully created a servlet
that accessed an entity bean to do a query on a database. It didn't EXACTLY work the way I had hoped, but I did confirm my finder method retrieved data off my database table. I created a CMP bean.

I need help understanding ABSTRACT-SCHEMA-NAME. How do/Can you map a schema name to a physical database table ? At first, I was putting the data base table into the <ABSTRACT-SCHEMA-NAME> attibute on my DD because
the schema name is also in the EJB QL query. I found this very confusing.

Then after a while, I noticed an empty table being created when I deployed my EAR to the server. I changed my <ABSTRACT-SCHEMA-NAME> attribute in my DD to match the newly created table, inserted a row on the newly created table, then it worked. But, I'm still puzzled.

Can you do this with BMP beans ? I understand they are a bit more flexible, but YOU have to maintain the database connection code
and code your own queries.

Any new insights would be greatly appreciated. Thank You in advanced.

Chris
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your <abstract-schema-name> element, you declare your CMP fields. These fields are mapped to the real DB fields by a vendor-supplied tool. This is typically a GUI which enables you to connect to a specific DB and drag and drop your CMP fields to columns in one or more tables. Check your vendor's documentation on how to do this.
 
Chris Voge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm also using XDoclet in my beans to generate variables in
my XML files. I found an attribute called ejb.persistance
where you can specify an actual table name. I'm going to give
that a try.

Thanks for your reply.
 
Chris Voge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ejb.persistance tag worked like a charm
for an existing table.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!