Hello,

An informal way of doing this might look like that:

// This should work with any dialect
Factory factory = new Factory(dialect);

// Create a local render context and configure it to declare tables (e.g.
"ADM_USER" AS "A0")
RenderContext ctx = factory.renderContext().declareTables(true);

// Check if the declaration of the aliased table starts with the
declaration of the unaliased table
assertTrue(ctx.render(alias).startsWith(ctx.render(user)));

Would that do the trick for you?

Note, even if Factory.renderContext()'s Javadoc claims that this is
internal API, I have plans of stabilising this API in jOOQ 3.0, to make it
available for advanced users:
https://github.com/jOOQ/jOOQ/issues/1663

Another option is to compare the record type:
assertEquals(alias.getRecordType(), user.getRecordType());

It is unlikely that any other kind of Table will produce the same generated
record type

Cheers
Lukas


2013/1/10 digulla <[email protected]>

> I need to find out if an alias points to the some table, basically:
>
>         Table<?> user = Tables.ADM_USER;
>         Table<?> alias = user.as( "A0" );
>
>         assertTrue( alias.equals( user ) );
>
>
> How can I do that?
>
>

Reply via email to