[weld-dev] SQL framework proof of concept

Gavin King gavin.king at gmail.com
Sat Nov 28 18:06:47 EST 2009


Nick, javassist works at runtime, the generated classes are not
available to the compiler. So all code that uses FooEntity is
uncompilable. Javaassist is useful for creating new implementations of
types that already exist, not for creating new types.

What you're describing can be achieved using a Java6 processor (a
compiler plugin), which is what we are doing in Hibernate for
generating the X_ classes for entity classes X.

But in this case, we don't have any entities. These classes exist to
represent database tables. I don't love the idea of going off to the
database and reading the db metadata every time I compile my code ;-)

On Sat, Nov 28, 2009 at 5:59 PM, Nicklas Karlsson <nickarls at gmail.com> wrote:
> OK. I was just brainstorming and thought something in the lines of
>
> Starting with a class Foo
> Use javassist magic to create a new class names e.g. FooEntity
> Sneak in into the classloader somehow and use it dynamically (like
> Class.forName) hiding details from the user
>
> But you know more of this stuff than I...
>
>
>
> On Sun, Nov 29, 2009 at 12:50 AM, Gavin King <gavin.king at gmail.com> wrote:
>> Eh? By definition you can't do anything with the type system at *runtime*!
>>
>> On Sat, Nov 28, 2009 at 5:41 PM, Nicklas Karlsson <nickarls at gmail.com> wrote:
>>> Would it be doable to use e.g. Javassist to transform a class into one
>>> of those static typesafe "entity classes" at runtime?
>>>
>>> On Sat, Nov 28, 2009 at 8:25 AM, Arbi Sookazian <asookazian at gmail.com> wrote:
>>>> Looks like there are two tables (users and permissions) but testQuery2() and
>>>> testQuery3() both select only from one table - users.  So now we need a
>>>> small db schema (i.e. data model).  The typical customers and orders would
>>>> suffice to demo FK and potential outer joins.  How can I define customerId
>>>> as a FK on orders table?  Ideally, it would be nice to be able to do all
>>>> this via tooling (i.e. exec a wizard that would generate the code for us).
>>>> But we need to be able to do all this via the API for now...
>>>>
>>>> On Fri, Nov 27, 2009 at 3:16 PM, Gavin King <gavin.king at gmail.com> wrote:
>>>>>
>>>>> New rev, with ability to pass SQL as strings.
>>>>>
>>>>> On Fri, Nov 27, 2009 at 4:47 PM, Gavin King <gavin.king at gmail.com> wrote:
>>>>> > Latest, with a new approach to specifying types.
>>>>> >
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Gavin King
>>>>> gavin.king at gmail.com
>>>>> http://in.relation.to/Bloggers/Gavin
>>>>> http://hibernate.org
>>>>> http://seamframework.org
>>>>>
>>>>> _______________________________________________
>>>>> weld-dev mailing list
>>>>> weld-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/weld-dev
>>>>
>>>>
>>>> _______________________________________________
>>>> weld-dev mailing list
>>>> weld-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/weld-dev
>>>>
>>>
>>>
>>>
>>> --
>>> ---
>>> Nik
>>>
>>
>>
>>
>> --
>> Gavin King
>> gavin.king at gmail.com
>> http://in.relation.to/Bloggers/Gavin
>> http://hibernate.org
>> http://seamframework.org
>>
>
>
>
> --
> ---
> Nik
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the weld-dev mailing list