Hi Alex,
The entity's alias (or name) is based on the classname (DietyT) or the name
attribute of the Entity annotation (if one is specified).
It looks like your query is using the table name instead. If that's the case
you have two options, either change the query to use DietyT instead of
Diety, or add a name field to the Entity annotation.
ex.
@NamedQuery(name = "siblings", query = "select distinct sibling1 "
+ "from DeityT sibling1, DeityT sibling2 where "
+ "sibling1.father = sibling2.father " + "and
sibling1.mother = sibling2.mother "
+ "and sibling2 = ?1 and sibling1 <> ?1"),
or
@Entity(name="Diety") // the second solution from above
@Table(name = "Deity")
. . .
hope this helps,
-Mike
On 10/2/07, AlexD. <[EMAIL PROTECTED]> wrote:
>
>
> Hallo all,
>
> I have the following problem:
> I have a some table in DB with the name "Deity" but I customized my
> persistence object with other name "DeityT" and @Table annotation:
>
> @Entity
> @Table(name = "Deity")
> @NamedQueries( {
> ..
> })
> public class DeityT implements Serializable {
> ...
> }
>
>
> now I'm trying to execute some query, but I got an exception instead of
> resultset:
> Exception in thread "main"
> org.apache.openjpa.persistence.ArgumentException: Could not locate
> metadata
> for the class using alias "Deity". This could mean that the OpenJPA
> enhancer
> or load-time weaver was not run on the type whose alias is "Deity".
> Registered alias mappings: "{Deity=null, DeityT=[class relations.DeityT]}"
> at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(
> MetaDataRepository.java:362)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(
> JPQLExpressionBuilder.java:169)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(
> JPQLExpressionBuilder.java:147)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(
> JPQLExpressionBuilder.java:216)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(
> JPQLExpressionBuilder.java:186)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(
> JPQLExpressionBuilder.java:179)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$500(
> JPQLExpressionBuilder.java:66)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(
> JPQLExpressionBuilder.java:1678)
> at
> org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:55)
> at
> org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(
> ExpressionStoreQuery.java:148)
> at
> org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:652)
> at
> org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java
> :633)
> at
> org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java
> :599)
> at
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:661)
> at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java
> :1487)
> at
> org.apache.openjpa.kernel.DelegatingQuery.getOperation(
> DelegatingQuery.java:123)
> at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java
> :227)
> at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:277)
> at relations.Main.runQueries(Main.java:141)
> at relations.Main.main(Main.java:53)
>
>
>
> Could someone say what I'm doing wrong and how to solve this problem?
>
>
> source codes: http://www.nabble.com/file/p12998099/openjpa.bug.zip
> openjpa.bug.zip
> You have to call ant run to execute this test.
> List of my lib directory:
>
> commons-collections-3.2.jar
> commons-lang-2.1.jar
> commons-logging-1.0.4.jar
> commons-pool-1.3.jar
> derby-10.2.2.0.jar
> geronimo-jms_1.1_spec-1.0.1.jar
> geronimo-jpa_3.0_spec-1.0.jar
> geronimo-jta_1.1_spec-1.1.jar
> openjpa-1.0.0.jar
> serp-1.13.1.jar
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-table%27s-alias-tf4554663.html#a12998099
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>