Well I suppose as long as it was all sterilized first it would be fine then. But then, it has been along time since I canned anything.
Edit: If the cake or bread is baked in the jar, how would you get it out when ready to eat it? Just eat it straight from the jar? I know, I am not helping just coming up with more questions, LOL.