[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [dali-dev] Re: schema for JPA connections
|
Hi Neil,
I guess the main scenario that I am trying to address is a new user who
wants to add some JPA data to their application. They see the JPA
Generate Entities menu item and run that - they define their connection,
they choose their schema and generate entities. Now they attempt to run
their app but run into two problems:
1) no connection information is set up
2) the wrong schema is being used
However, the user definitively specified both of these things when they
ran through the scenario. So it may be confusing why things aren't
working. I'd like to see some assistance for the user in these cases.
Regarding the schema, what about when generating entities with a
non-default schema, if there was an option to "Make this my default
schema" or something to that affect. This would add the schema to your
orm.xml (and possibly an option to add the schema directly to your
entities via annotation). This would alleviate the problem. The
option could even be off by default, so it would have to be deliberately
enabled. What about something along these lines?
As for assisting with the connection, I've brought this up several times
on the list. I'm pretty sure that it's a function of the platform, but
I'm not sure how to best handle this. That is, if the user selects the
OpenJpa platform and defines a connection, can I hook in somewhere to
allow the user to push this connection information to the
persistence.xml (via the provider-specific properties, or a
jta-datasource reference)? Ideally, I'd like some way to hook into the
Generate Entities wizard where you select your connection and schema, to
provide my own platform-specific options. Could something like this be
set up? It may be possible to do now, by extending some of the existing
Dali wizards, but that's usually not the preferred way to go. I was
trying to handle this after the Generate Entities operation has run, but
couldn't find a way to get the connection or schema that was used in
that operation. It doesn't look like the selected connection gets set
in project's JPA property page, so I couldn't rely on that property
being set. Is this by design that the user has to explicitly go in and
set this?
Thanks
Tom
dali-dev-request@xxxxxxxxxxx wrote:
the way things are going to work at runtime when setting your JDBC
userName in the provider properties. This default is properly
overridden in the orm.xml persistence-unit-defaults, or as specified by
annotation, or as specified in the orm.xml for a given element. There
are a LOT of places to set the schema, depending on the granularity that
you need. This JPA meta data is the where schema information is stored.
Our validation has to take into account all of these possible schema
settings to determine whether a database object can be resolved for a
given Entity/Mapping. There is no master, all overriding, tool-only
schema setting. We have too many schema settings to keep track of as it
stands. ;) There is a possible argument for having this, but with so
many existing schema settings and defaults, I worry that by removing
confusion on the tooling side with a simple setting, you might
complicate issues when you try to run your application and don't get the
results that you expect.
As for Entity Generation, this does create a bit of an issue when
generating from the non-default schema. I'll carry that conversation
forward in the bug, but it probably needs some discussion to determine
the best course of action.
Neil