Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Simplifying Ebean Internals ... by Removing MapBean fuctionality (and DB meta data use)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
RobB  
View profile  
 More options May 25 2009, 7:54 pm
From: RobB <rbygr...@yahoo.com>
Date: Mon, 25 May 2009 16:54:44 -0700 (PDT)
Local: Mon, May 25 2009 7:54 pm
Subject: Re: Simplifying Ebean Internals ... by Removing MapBean fuctionality (and DB meta data use)

UPDATE:
========
Code is not in HEAD yet but I have working code that has removed the
dependency on DB meta data.

NOTES:
=======
- MapBean:
Changed name to SqlRow... and removed the ability to insert/update/
delete SqlRow/MapBean's. They can only be used for queries now!!

- @ManyToOne(optional=false) / @NotNull
I'm using the optional attribute on @ManyToOne to determine inner/
outer join. By default optional=true for the annotation. Alternatively
if you put a @NotNull on the property and that has the same effect as
@ManyToOne(optional=false).  Previously the DB meta data checked the
nullablity of columns to automagically determine this.

- Lost the hidden/automagic @NotNull and @Length validation.
So now you need to explictly use @NotNull and @Length to get that
validation on the properties. In v1.2 these could be automatically
added from the DB meta data.

- Foreign Key naming convention
Following the JPA spec in this regard ... so for a  @ManyToOne
billiingAddress...
1). the property name "billingAddress" gets converted to a DB column
name using the naming convention (in my case with underscores... this
becomes billing_address)
2). then _{primary key of target} is appended ... so you end up with
billing_address_id (where "id" was the primary key column of the
target table)

... I think this will generally work well and not using the DB meta
data for this will be fine.

- Internals much simpler
I think this has cleaned up things significantly!!  Lots of stuff
removed, and the process of reading the 'deployment' information looks
a lot better/easier to follow.

MOVING FORWARD:
================
At this point I'm thinking about how to hook in DDL generation (with
an eye on reverse generation as well).

My current thinking is to provide public "Meta entity beans" for all
the Beans/Properties that can be queried out of Ebean (just like the
query statistics).

// find all the beans and their properties
List<MetaBean> beans = Ebean.find(MetaBean.class).findList();

So this information is sufficient for DDL generation... and in the
future for other code generation frameworks.

In a similar way I'm thinking of querying the Table/Column.

// find the tables/columns/key constraints in a given catalog/schema
// ... typically useful for generating java entity bean code
List<MetaTable> tables = Ebean.find(MetaTable.class).where().add
("schema like 'o%'").findList()

All feedback / thoughts welcome!!!

Cheers, Rob.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.