[odb-users] Including a custom object field member in the persistence class

Myoungkyu Song mksong at vt.edu
Sun Dec 19 01:21:00 EST 2010


# ODB version: 1.0.0
# OS: Linux 2.6.32-26-generic-Ubuntu
# Compiler: g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3

Hi, Boris and odb-users

When it comes to including a custom object field member in the persistence
class, the ODB-Example package mentioned in the ODB Manual, specifically the
mapping example, demonstrates how to specify the additional source file,
"traits.hxx" for the ODB compiler, in order to provide the mapping to the DB
system type. However, I have gotten the following errors related to the
odb-runtime libraries.
===================================================================
time g++ -g -I/home/smk/x10_2.1.0/include -I/home/smk/workspace/x10test1 -I.
-Wno-long-long -Wno-unused-parameter -pthread -msse2 -mfpmath=sse
-L/usr/local/lib -L/usr/local/lib/mysql -lodb -lodb-mysql -c dbtrax.cc -o
dbtrax.o
dbtrax.cc: In function ‘void makePersistence(StringRef)’:
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
dbtrax.cc:25: warning: deprecated conversion from string constant to ‘char*’
In file included from /usr/local/include/odb/database.hxx:13,
                from dbtrax.cc:8:
/usr/local/include/odb/traits.hxx: At global scope:
/usr/local/include/odb/traits.hxx: In instantiation of
‘odb::object_traits<x10aux::ref<x10::lang::String> >’:
dbtrax.cc:31:   instantiated from here
/usr/local/include/odb/traits.hxx:81: error: invalid use of incomplete type
‘struct odb::access::object_traits<x10aux::ref<x10::lang::String> >’
/usr/local/include/odb/forward.hxx:23: error: declaration of ‘struct
odb::access::object_traits<x10aux::ref<x10::lang::String> >’
/usr/local/include/odb/traits.hxx:84: error: invalid use of incomplete type
‘struct odb::access::object_traits<x10aux::ref<x10::lang::String> >’
/usr/local/include/odb/forward.hxx:23: error: declaration of ‘struct
odb::access::object_traits<x10aux::ref<x10::lang::String> >’
dbtrax.cc: In function ‘void makePersistence(StringRef)’:
dbtrax.cc:31: error: no matching function for call to
‘odb::database::persist(StringRef&)’
Command exited with non-zero status 1
1.68user 0.09system 0:01.77elapsed 100%CPU (0avgtext+0avgdata
288352maxresident)k
0inputs+8outputs (0major+18353minor)pagefaults 0swaps
make: *** [dbtrax.o] Error 1
root at smk-laptop:/home/smk/workspace/x10test1#
=========================================================

So, do I need to carry out any additional work? For example, I saw the
comments below in another "traits.hxx" for specialization. Would you be able
to provide the related example? The example package does not offer the
corresponding example.

 // template <typename T>
 // class access::object_traits;
 //
 // Specializations should inherit from object_memory, object_factory
 // and define the following members:
 //
 // id_type               - object id (primary key) type
 // id_type id (const T&) - get object id
 //
 // void persist (database&, T&)
 // void update (database&, T&)
 // void erase (database&, const id_type&)
 // pointer_type find (database&, const id_type&)
 // bool find (database&, const id_type&, T&)
 //

Best regards,
Myoungkyu Song
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbtrax.cc
Type: text/x-c++src
Size: 911 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20101219/78660868/dbtrax.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbtrax.h
Type: text/x-chdr
Size: 290 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20101219/78660868/dbtrax.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Driver.cc
Type: text/x-c++src
Size: 4767 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20101219/78660868/Driver.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Driver.h
Type: text/x-chdr
Size: 2210 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20101219/78660868/Driver.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 3067 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20101219/78660868/Makefile.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SequenceModel.h
Type: text/x-chdr
Size: 2586 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20101219/78660868/SequenceModel.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SequenceModel.cc
Type: text/x-c++src
Size: 4956 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20101219/78660868/SequenceModel.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: traits.hxx
Type: text/x-c++hdr
Size: 972 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20101219/78660868/traits.hxx


More information about the odb-users mailing list