Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GoikLectures
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Goik Martin
GoikLectures
Commits
062841bc
Commit
062841bc
authored
10 years ago
by
Goik Martin
Browse files
Options
Downloads
Patches
Plain Diff
Fixed JPA metabodel bootstrap problem. Yeah!
parent
9383459a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sda2/P/forum_1/pom.xml
+32
-32
32 additions, 32 deletions
Sda2/P/forum_1/pom.xml
Sda2/P/forum_1/src/main/java/de/hdm_stuttgart/mi/sda2/forum/tools/Credential.java
+10
-15
10 additions, 15 deletions
...java/de/hdm_stuttgart/mi/sda2/forum/tools/Credential.java
with
42 additions
and
47 deletions
Sda2/P/forum_1/pom.xml
+
32
−
32
View file @
062841bc
...
...
@@ -131,6 +131,38 @@
<target>
1.8
</target>
</configuration>
</plugin>
<!-- Eclipse link JPA Metamodel -->
<plugin>
<groupId>
org.bsc.maven
</groupId>
<artifactId>
maven-processor-plugin
</artifactId>
<version>
2.2.4
</version>
<executions>
<execution>
<id>
process
</id>
<goals>
<goal>
process
</goal>
</goals>
<phase>
generate-sources
</phase>
<configuration>
<options>
<eclipselink.persistencexml>
${basedir}/src/main/resources/META-INF/persistence.xml
</eclipselink.persistencexml>
</options>
<processors>
<processor>
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
</processor>
</processors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>
org.eclipse.persistence
</groupId>
<artifactId>
org.eclipse.persistence.jpa.modelgen.processor
</artifactId>
<version>
${eclipse.link.version}
</version>
</dependency>
</dependencies>
</plugin>
<!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
<!-- directory is cleaned properly -->
<plugin>
...
...
@@ -206,38 +238,6 @@
</configuration>
</plugin>
<!-- Eclipse link JPA Metamodel -->
<plugin>
<groupId>
org.bsc.maven
</groupId>
<artifactId>
maven-processor-plugin
</artifactId>
<version>
2.2.4
</version>
<executions>
<execution>
<id>
process
</id>
<goals>
<goal>
process
</goal>
</goals>
<phase>
generate-sources
</phase>
<configuration>
<!-- Does not work: Bootstrap Problems! -->
<outputDirectory>
src/main/java
</outputDirectory>
<options>
<eclipselink.canonicalmodel.subpackage>
jpametamodel
</eclipselink.canonicalmodel.subpackage>
</options>
<processors>
<processor>
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
</processor>
</processors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>
org.eclipse.persistence
</groupId>
<artifactId>
org.eclipse.persistence.jpa.modelgen.processor
</artifactId>
<version>
${eclipse.link.version}
</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<pluginManagement>
<plugins>
...
...
This diff is collapsed.
Click to expand it.
Sda2/P/forum_1/src/main/java/de/hdm_stuttgart/mi/sda2/forum/tools/Credential.java
+
10
−
15
View file @
062841bc
...
...
@@ -3,14 +3,13 @@ package de.hdm_stuttgart.mi.sda2.forum.tools;
import
java.util.List
;
import
javax.persistence.EntityManager
;
import
javax.persistence.TypedQuery
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
de.hdm_stuttgart.mi.sda2.forum.domain.User
;
import
de.hdm_stuttgart.mi.sda2.forum.domain.
jpametamodel.
User_
;
import
de.hdm_stuttgart.mi.sda2.forum.domain.User_
;
public
class
Credential
{
...
...
@@ -19,26 +18,22 @@ public class Credential {
public
static
User
check
(
final
String
email
,
final
String
cleartextPassword
)
{
final
CriteriaBuilder
qb
=
em
.
getCriteriaBuilder
();
final
CriteriaBuilder
critBuilder
=
em
.
getCriteriaBuilder
();
final
CriteriaQuery
<
User
>
allUsers
=
qb
.
createQuery
(
User
.
class
);
final
Root
<
User
>
u
=
allUsers
.
from
(
User
.
class
);
Predicate
condition
=
qb
.
equal
(
u
.
get
(
User_
.
email
),
email
);
allUsers
.
where
(
condition
);
final
CriteriaQuery
<
User
>
userQuery
=
critBuilder
.
createQuery
(
User
.
class
);
final
Root
<
User
>
u
serRoot
=
userQuery
.
from
(
User
.
class
);
final
Predicate
matchingEmail
=
critBuilder
.
equal
(
u
serRoot
.
get
(
User_
.
email
),
email
);
userQuery
.
where
(
matchingEmail
);
TypedQuery
<
User
>
q
=
em
.
createQuery
(
allUsers
);
List
<
User
>
result
=
q
.
getResultList
();
final
List
<
User
>
result
=
em
.
createQuery
(
userQuery
).
getResultList
();
if
(
1
==
result
.
size
())
{
final
User
user
=
result
.
get
(
0
);
if
(
HashProvider
.
check
(
cleartextPassword
.
toCharArray
(),
user
.
getPassword
()))
{
return
user
;
}
}
else
{
em
.
detach
(
user
);
}
}
return
null
;
// em.getTransaction().begin();
//
// em.getTransaction().commit();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment