-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Mapping von GregorianCalendar
PostPosted: Mon Mar 06, 2006 11:25 am 
Newbie

Joined: Mon Mar 06, 2006 9:48 am
Posts: 5
Hallo,

wie sieht das Exakte mapping von GregorianCalendar aus???

Hibernate version:
Hibernate 3.x (last public release)

Mapping documents:
<property name="geburtsdatum" column="Geburtsdatum" type="calendar"/>
<property name="sperre" column="Sperre" type="calendar"/>

Full stack trace of any exception that occurs:

log4j:ERROR Could not instantiate SimpleDateFormat with ABOLUTE
java.lang.IllegalArgumentException: Illegal pattern character 'A'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:678)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:497)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:446)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:427)
at org.apache.log4j.helpers.PatternParser.finalizeConverter(PatternParser.java:266)
at org.apache.log4j.helpers.PatternParser.parse(PatternParser.java:187)
at org.apache.log4j.PatternLayout.setConversionPattern(PatternLayout.java:447)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:205)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:164)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:129)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:649)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:441)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:468)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:122)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:324)
at de.kartman.config.Config.<init>(Config.java:27)
at de.kartman.Kartman.main(Kartman.java:14)
log4j:ERROR Could not instantiate SimpleDateFormat with ABOLUTE
java.lang.IllegalArgumentException: Illegal pattern character 'A'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:678)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:497)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:446)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:427)
at org.apache.log4j.helpers.PatternParser.finalizeConverter(PatternParser.java:266)
at org.apache.log4j.helpers.PatternParser.parse(PatternParser.java:187)
at org.apache.log4j.PatternLayout.setConversionPattern(PatternLayout.java:447)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:205)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:164)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:129)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:649)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:324)
at de.kartman.config.Config.<init>(Config.java:27)
at de.kartman.Kartman.main(Kartman.java:14)
[ INFO] 2006-03-06 16:21:38,027 Environment:479 - Hibernate 3.1.2

Name and version of the database you are using:
MYSQLEs funktioniert (beim Laden und Speichern),
aber warum die Fehlermeldung???

JavaCode:


public class PrivatKunde extends Kunde{

private GregorianCalendar geburtsdatum;
private GregorianCalendar sperre;

public PrivatKunde(){
this.geburtsdatum = new GregorianCalendar();
this.sperre = null;
}

public void setGeburtsdatum(GregorianCalendar geburtsdatum){
this.geburtsdatum = geburtsdatum;
}

public GregorianCalendar getGeburtsdatum(){
return this.geburtsdatum;
}

public void setSperre(GregorianCalendar sperre){
this.sperre = sperre;
}

public GregorianCalendar getSperre(){
return this.sperre;
}

regards

eliot


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 5:59 am 
Beginner
Beginner

Joined: Tue Jul 19, 2005 5:08 am
Posts: 26
Location: Germany
ich würde an deiner stelle für die datenbank und für deine bean java.util.Date verwenden, das reicht vollkommen aus. Wenn du GregorianCalendar brauchst, kannst du ja in deiner Anwendung immer noch entsprechend casten.

greetings

arno


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 9:24 am 
Newbie

Joined: Mon Mar 06, 2006 9:48 am
Posts: 5
Hallo,

ich habe es mit Date probiert, leider mit der gleichen Fehlermeldung.
Ich habe jetzt folgende Lösung:

Java-Klasse:

import java.util.Calendar;
import java.util.GregorianCalendar;

public class PrivatKunde extends Kunde{

private Calendar geburtsdatum;
private Calendar sperre;
private String erzname;
private String erzvorname;
private boolean lizenz;

public PrivatKunde(){
this.geburtsdatum = new GregorianCalendar();
this.sperre = new GregorianCalendar();
}

public void setGeburtsdatum(Calendar geburtsdatum){
this.geburtsdatum = geburtsdatum;
}

public Calendar getGeburtsdatum(){
return this.geburtsdatum;
}

public void setSperre(Calendar sperre){
this.sperre = sperre;
}

public Calendar getSperre(){
return this.sperre;
}

Mapping datei:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0/EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="de.kartman.objects.PrivatKunde" table="PrivatKunde">
<composite-id name="pk">
<key-property name="primarykey" column="PrivatID">
</key-property>
<key-property name="betriebid" column="BetriebID">
</key-property>
</composite-id>
<property name="anrede" column="Anrede" />
<property name="email" column="Email" />
<property name="Nationalitaet" column="Nationalitaet" />
<property name="notiz" column="Notiz" />
<property name="ort" column="Ort" />
<property name="postleitzahl" column="Postleitzahl" />
<property name="rabatt" column="Rabatt" />
<property name="strassehausnummer" column="StrasseHausnummer" />
<property name="telefona" column="TelefonA" />
<property name="telefonb" column="TelefonB" />
<property name="name" column="Name" />
<property name="vorname" column="Vorname" />
<property name="erzname" column="ErzName" />
<property name="erzvorname" column="ErzVorname" />
<property name="lizenz" column="Lizenz" />
<property name="geburtsdatum" column="Geburtsdatum" type="calendar_date"/>
<property name="sperre" column="Sperre" type="calendar_date"/>

</class>
</hibernate-mapping>

Und immer noch golgende Fehlermedung, obwohl alles richtig in der
Datenbank landet:

log4j:ERROR Could not instantiate SimpleDateFormat with ABOLUTE
java.lang.IllegalArgumentException: Illegal pattern character 'A'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:678)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:497)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:446)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:427)
at org.apache.log4j.helpers.PatternParser.finalizeConverter(PatternParser.java:266)
at org.apache.log4j.helpers.PatternParser.parse(PatternParser.java:187)
at org.apache.log4j.PatternLayout.setConversionPattern(PatternLayout.java:447)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:205)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:164)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:129)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:649)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:441)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:468)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:122)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:324)
at de.kartman.config.Config.<init>(Config.java:27)
at de.kartman.Kartman.main(Kartman.java:14)
log4j:ERROR Could not instantiate SimpleDateFormat with ABOLUTE
java.lang.IllegalArgumentException: Illegal pattern character 'A'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:678)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:497)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:446)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:427)
at org.apache.log4j.helpers.PatternParser.finalizeConverter(PatternParser.java:266)
at org.apache.log4j.helpers.PatternParser.parse(PatternParser.java:187)
at org.apache.log4j.PatternLayout.setConversionPattern(PatternLayout.java:447)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:205)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:164)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:129)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:649)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:324)
at de.kartman.config.Config.<init>(Config.java:27)
at de.kartman.Kartman.main(Kartman.java:14)

irgend eine Idee??

regards
eliot


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 10:50 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
sicher, dass Dein Fehler was mit Hibernate zu tun hat? Ich kann im Stacktrace nicht einen Verweis auf Hib finden.
Kontrolliere mal Deine log4j-Settings ;)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 08, 2006 6:28 am 
Beginner
Beginner

Joined: Tue Jul 19, 2005 5:08 am
Posts: 26
Location: Germany
ich würde mal auf das date pattern in deiner log4ja konfig tippen....

java.lang.IllegalArgumentException: Illegal pattern character 'A'

das klingt jedenfalls sehr verdächtig


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 13, 2006 12:08 pm 
Beginner
Beginner

Joined: Thu Apr 21, 2005 5:37 am
Posts: 45
Location: Switzerland
sollte wahrscheinlich "ABSOLUTE" statt "ABOLUTE" heissen, ist aber nur eine Vermutung.
Falls du Calendar in der Klasse brauchst, schau dir mal http://www.hibernate.org/hib_docs/v3/re ... pes-custom an.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.